N/APosted on - 03/13/2013
I am exercising Catch routines to continue my widget program's event handlers running, as you advice, on the other hand by performing so I cannot form out someplace the errors come.
Is there a little method to receive an error trace back in a widget program that is exercising a Catch error handler?
FSC_SURFACE_ELEVATION_COLORS: Case statement found no matches.
Case statement found no matches.
The main problem with Catch routines is that they engage your widget program for ever in the running mode. It is easy to put a simple "Help, /Traceback" in the Catch code, so that the root cause of the catch routine can be identified.
Basically you need to find the event handler that is causing the error. Running the help command calling the stack would do the trick illustrated below:-
callingRoutine = (Str_Sep(StrCompress(callStack)," "))
Then print the last message that caused the error using the Last_Message keyword.The command looks as below:-
Help, /Last_Message, Output=traceback
Print, 'Traceback Report from ' + StrUpCase(callingRoutine) + ':'
FOR j=0,N_Elements(traceback)-1 DO Print, " " + traceback[j]
It is a good practice to incorporate the error message code that we you have a general Catch error handler. General Catch Error Handler code lines below:
IF theError NE 0 THEN BEGIN
void = Error_Message()
Finally it is good idea to have the text message to be customized in order to find the exact cause of error line from your code. You can achieve that something like this:
Traceback Report from FSC_SURFACE_ELEVATION_COLORS:
% Case statement found no matches.
% Execution halted at: FSC_SURFACE_ELEVATION_COLORS 388 C:IDLIDL54davidfsc_surface.pro
You can print your own message
IF test EQ 0 THEN Message, 'The test failed, my Man.', /NoName
Hope this helps.