How can I show error line numbers when running .sav on Virtual Machine [message #86253] |
Mon, 21 October 2013 19:51  |
timothyja123
Messages: 57 Registered: February 2013
|
Member |
|
|
Hi guys,
My application has the following code to catch as display errors:
CATCH, errorNum
IF (errorNum NE 0) THEN BEGIN
CATCH, /Cancel
HELP, /Last_Message, Output = lastError
v = DIALOG_MESSAGE(LastError)
Error = LastError[0]
RETURN
ENDIF
The application is built into a .sav file and run on the IDL Virtual Machine. My problem is that when an error is hit there are no line numbers in the error message. Is there some way to build the .sav file to retain and display the line numbers like when running directly from the source in the Workbench?
Tim
IDL version 8.2.3
|
|
|
|
|
|
|
Re: How can I show error line numbers when running .sav on Virtual Machine [message #86258 is a reply to message #86254] |
Mon, 21 October 2013 22:20  |
Moritz Fischer
Messages: 32 Registered: June 2013
|
Member |
|
|
Indeed, you can get the line number with the statement
(SCOPE_TRACEBACK( /STRUCT )).line[-1]
The problem is, in your case, where to put it (in the catch block
doesn't make sense). Maybe you could write a wrapper routine for error
handling, and thus preserve the line number?
Am 22.10.2013 05:22, schrieb Michael Galloy:
> <timothyja123@gmail.com> wrote:
>> Hi guys,
>>
>> My application has the following code to catch as display errors:
>>
>> CATCH, errorNum
>> IF (errorNum NE 0) THEN BEGIN
>> CATCH, /Cancel
>> HELP, /Last_Message, Output = lastError
>> v = DIALOG_MESSAGE(LastError)
>> Error = LastError[0]
>> RETURN
>> ENDIF
>>
>>
>> The application is built into a .sav file and run on the IDL Virtual
>> Machine. My problem is that when an error is hit there are no line
>> numbers in the error message. Is there some way to build the .sav file to
>> retain and display the line numbers like when running directly from the
>> source in the Workbench?
>>
>> Tim
>>
>> IDL version 8.2.3
>
> I'm not near a computer, but how about the TRACEBACK keyword to HELP?
>
> Mike
>
|
|
|