Case statement found no matches.

Asked By 0 points N/A Posted on -
qa-featured

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


FSC_SURFACE_ELEVATION_COLORS: Case statement found no matches.

SHARE
Answered By 0 points N/A #170893

Case statement found no matches.

qa-featured
Hi John,
 
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:-
 
   Help, Calls=callStack
   callingRoutine = (Str_Sep(StrCompress(callStack[1])," "))[0]
 
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,''
   Print, 'Traceback Report from ' + StrUpCase(callingRoutine) + ':'
   Print, ''
   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:
 
Catch, theError
   IF theError NE 0 THEN BEGIN
      Catch, /Cancel
      void = Error_Message()
      RETURN
    ENDIF
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
     %                       $MAIN$  
You can print your own message
 
IF test EQ 0 THEN Message, 'The test failed, my Man.', /NoName
 
Hope this helps.
 
Regards,
 
Alice

Related Questions