how to catch a math error? [message #34805] |
Thu, 17 April 2003 12:17 |
J Li
Messages: 1 Registered: April 2003
|
Junior Member |
|
|
Hi,
I am trying to figure out how to trap the math error and dump the error
message to a file. Math error is somehow different than other types of
errors? My test program is listed below.
I have done tests for I/O error or raising an exception by issuing a
"message" call. They all work as expected, that is I got error message in
the myLog.err file and the program exited gracefully. So far, I have not
been able to do the same for math error. Please help!
Email: jylimd(at)yahoo(dot)com
pro test3
on_error, 2
print, "i am in test3"
x = 1 / 0
; message, "Error occurs in test 3"
end
pro test2
on_error,2
print, "i am in test2"
test3
end
pro test1
on_error,2
print, "i am in test 1"
test2
end
pro test
Catch, myError
if(myError NE 0) then begin
Catch, /Cancel
openw, lun, "myLog.err", /get_lun
printf,lun, !Error_State.Msg
free_lun, lun
return
endif
test1
end
|
|
|