SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Error Trapping

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Error Trapping
Author Message
Loril



Joined: 21 Feb 2007
Posts: 82

Post Error Trapping Reply with quote
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 View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6500

Post Reply with quote
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 View user's profile Send private message
Loril



Joined: 21 Feb 2007
Posts: 82

Post Reply with quote
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 View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6500

Post Reply with quote
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 View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
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


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.