Charmed Quark Systems, Ltd. - Support Forums and Community
New Exception Behavior 4.2.16? - Printable Version

+- Charmed Quark Systems, Ltd. - Support Forums and Community (https://www.charmedquark.com/vb_forums)
+-- Forum: General Discussion (https://www.charmedquark.com/vb_forums/forumdisplay.php?fid=3)
+--- Forum: CQC Support (https://www.charmedquark.com/vb_forums/forumdisplay.php?fid=9)
+--- Thread: New Exception Behavior 4.2.16? (/showthread.php?tid=7970)



New Exception Behavior 4.2.16? - wuench - 11-19-2012

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;



New Exception Behavior 4.2.16? - Dean Roddey - 11-19-2012

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.