System.ArgumentException ex; try { throw new System.ArgumentException("Invalid argument specified"); } catch(ex) { error(ex.Message); } /////////////////////////////////////////////////////////////////////////////// try { // call to .NET code which throws exception } catch(Exception::CLRError) { System.Exception ex = CLRInterop::getLastException(); error(ex.Message); } /////////////////////////////////////////////////////////////////////////////// var athing = new SomethingDisposable(); try { // Do work. } finally { if (athing != null) athing.Dispose(); } /////////////////////////////////////////////////////////////////////////////// static void TryCatchThrowError1Job(Args _args) { /*** The 'throw' does not directly add a message to the Infolog. The exception is caught. ***/ try { info("In the 'try' block. (j1)"); throw Exception::Error; } catch (Exception::Error) { info("Caught 'Exception::Error'."); } /********** Actual Infolog output Message (03:43:45 pm) In the 'try' block. (j1) Caught 'Exception::Error'. **********/ }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter