Charmed Quark Systems, Ltd. - Support Forums and Community

Full Version: New Exception Behavior 4.2.16?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I just noticed this behavior when working on a driver and it seems new. The gist is that exceptions are booting you out of the Try block but not directly into the Catch block, so anything in between gets run. I am pretty sure it didn't used to be this way, I have compiled and attached a sample macro to demonstrate.

I can't remember ever having to exclude stuff from inbetween EndTry and Catch, but it seems like some sort of enforcement is necessary here if this is how it is going to be....

Code:
Method TestExcept()
        Begin
        Locals=
            String  strVal("ABC123");
            String  strTemp;
        EndLocals;

        Try
            // Extract an Invalid Index
            strVal.ExtractSubStr(8,Card4.kMaxValue,strTemp);
            
        EndTry;
            ConOut.FmtStr("Should not ever hit here");
            ConOut.NewLn();
            ConOut.Flush();
        Return;

        Catch
            ConOut.FmtStr("Exception Caught");
            ConOut.NewLn();
            ConOut.Flush();
        EndCatch;
    EndMethod;
Yes, that is an issue. It's on the list to deal with, but for now you just shouldn't have anything between a try and a catch at all, and when I fix it that will be disallowed, as it is in any exception based language AFAIK.