|
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
Loril
Joined: 21 Feb 2007 Posts: 82
|
|
Error Trapping |
|
The way to trap a run-time error is to use the OnErrorGoTo statement, correct? Just to be extra safe, I even had a OnErrorStop statement within the error trapping module. However, none of them seems to work because 24x7 scheduler still goes into an infinite loop. Here's a sample from the log:
======================
2/26/2007 14:28:54 1 31 0 Import - Addvantage A run-time error occurred while executing automation script: Line 56. Not connected to database
2/26/2007 14:28:54 1 31 0 Import - Addvantage A run-time error occurred while executing automation script: Line 56. Not connected to database
2/26/2007 14:28:54 1 31 0 Import - Addvantage A run-time error occurred while executing automation script: Line 56. Not connected to database
2/26/2007 14:28:54 1 31 0 Import - Addvantage A run-time error occurred while executing automation script: Line 56. Not connected to database
======================
This error keeps on going until I 'end task' the 24x7 scheduler.
Here's the setup I have:
Main Job - Calls a script in the script library with some parameters.
Script in Script Library - This is where the run time error happens. The script goes like this:
OnErrorGoTo ALERTSTAFF
.....
..... (various codes)
ALERTSTAFF:
LogAddMessageEx("INFO",0,feed_cd,"Job hung/errored or did not run to completion")
EmailError(ErrorMsg,"Check log immediately")
DatabaseDisconnect
RaiseError ErrorMsg
OnErrorStop
Is there anything I needed to add to stop the job from running once it hits the first run-time error? Thanks!
|
|
Wed Feb 28, 2007 5:05 pm |
|
|
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7847
|
|
|
|
Hi,
You need to move OnErrorStop to be the first line after ALERTSTAFF label. This will prevent the endless loop caused by RaiseError call
Hope this helps
|
|
Wed Feb 28, 2007 6:14 pm |
|
|
Loril
Joined: 21 Feb 2007 Posts: 82
|
|
|
|
If I move the OnErrorStop to right after the ALERTSTAFF label, will the rest of the code under ALERTSTAFF run? Thanks.
|
|
Wed Feb 28, 2007 7:35 pm |
|
|
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7847
|
|
|
|
Yes. OnErrorStop doesn't mean to stop the script, it means to use the default error handler, which in your case means to to cancel OnErrorGoto instruction after itsi been executed and thus avoid the endless-loop.
|
|
Wed Feb 28, 2007 10:24 pm |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|