Jump to content
  • Advertisement

Catching two in a row

Recommended Posts

It seems if I have two try/catch blocks in a row in a function, the second one doesn't seem to catch anything. For example, this script:

void main() {
    try { throw ("1"); }
    catch { print ("Exception 1"); }

    try { throw ("2"); }
    catch { print ("Exception 2"); }

    try { throw ("3"); }
    catch { print ("Exception 3"); }

prints only this:

Exception 1

So the first exception is caught and handled correctly, and the second one aborts the script (which prints the aborting exception, in my case, so you see the "2").

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!