Page 1 of 2

Error during processing actions

Posted: Wed Sep 22, 2004 11:55 am
by John Long
I have a task with multiple actions. The first action is to stop a
service, then there are a few actions, then the last action is to
restart the service. If the second action fails then the whole task
will stop and the service never restarts. If the second action fails I
do not want any of the following actions to process with the exception
of the last one. Is there a way to put in an action that says if action
2 fails then start task "X" or skip to the last action? And also how
can I set an action if this action or task fails send an e-mail? Thanks
for any feed back.

Error during processing actions

Posted: Wed Sep 22, 2004 11:37 pm
by Oleg
There is "IsError" macrofunction. It returns a boolean value:   True - if error occured at previous action, False - otherwise. Put "If Then" action (with using IsError function) after action #2. Don't forget to change "If error occured" parameter at advanced options of the task. It must be equal to "Continue execution".

Error during processing actions

Posted: Thu Sep 23, 2004 6:14 am
by John Long
Ok. Here is how I am going to write the task. I will call it task B:
Stop service
Delay 30000 ms
remove nonempty folder "X"
IF Then {IsError}
    Start Service
    Send EMail
    Stop Task B
Else



   Continue

End If
   remove nonempty folder "Y"
   IF Then {IsError}

      Start Service

      Send EMail

      Stop Task B

Else


   Continue
End If

Is this how it should be?

Thanks for the help.



Error during processing actions

Posted: Thu Sep 23, 2004 6:24 am
by John Long
It seams that it would be easier if there was error handling
in each actions properties rather that having to create a whole bunch of If
Then statements. Maybe this could be built into future releases???

Error during processing actions

Posted: Thu Sep 23, 2004 6:43 am
by Oleg
Is this how it should be?


Not absolutely... See below

Stop service
Delay 30000 ms
remove nonempty folder "X"
IF Then {IsError}
   Start Service
   Send EMail
   Stop Task
Else
   remove nonempty folder "Y"
   IF Then {IsError}
      Start Service
      Send EMail
      Stop Task
   end if
end if

If statement at "If Then" is TRUE then task execute actions between "If Then" and "Else". Otherwise - actions between "Else" and "End if" (when "else" is present, of course)

"Continue" action can be used inside any loops only. Without loop it have no sense.
                                                    

Error during processing actions

Posted: Thu Sep 23, 2004 6:57 am
by Oleg
Probably you should do so ?

Stop service
Delay 30000 ms
remove nonempty folder "X"
IF Then {IsError}
   Start Service
   Send EMail
   Stop Task
end if
remove nonempty folder "Y"
IF Then {IsError}
   Start Service
   Send EMail
   Stop Task
end if

Error during processing actions

Posted: Thu Sep 23, 2004 7:06 am
by John Long
If there is no error for the first IF Then {IsError} the task will go
to the action after the first end if. Then I can put more IF Then
{IsError} statment for each action and end if. And I don't have to use
else. That is better. I will try it and let you know how it goes.

Error during processing actions

Posted: Thu Sep 23, 2004 7:50 am
by John Long
Worked Great.

Error during processing actions

Posted: Thu Sep 23, 2004 7:57 am
by Oleg
I am very glad

Error during processing actions

Posted: Thu Sep 23, 2004 8:16 am
by John Long
Hold the applauds. When I introduce an error the task did
not stop and there was not an email sent. I am not sure why. Any suggestions?