Re: Error Handling Advice [message #82706 is a reply to message #82703] |
Mon, 14 January 2013 12:02   |
Matthew Argall
Messages: 286 Registered: October 2011
|
Senior Member |
|
|
> I guess I will start with some with trial and ::ehem:: error ;-)
So, after a little work, I get a cascade of error messages
----------------------------
function add, a, b
Catch, theError
IF theError NE 0 THEN BEGIN
Catch, /CANCEL
void = Error_Message()
RETURN, !Null
ENDIF
RETURN, a + b
end
pro call_add
Catch, theError
IF theError NE 0 THEN BEGIN
Catch, /CANCEL
void = Error_Message()
RETURN
ENDIF
sum = add(a, b)
IF sum EQ !Null THEN message, 'Sum not valid'
END
--------------------------------
Should there be a STOP in there somewhere?
Is this were "add" would require an ON_ERROR, 2? I can imagine some cases where you would want to keep both CATCH statements...
|
|
|