Raise an error manually

Discuss RoboTask here
Post Reply
Developer99
Posts: 6
Joined: Wed Jan 23, 2013 3:01 pm
Location: United States

Raise an error manually

Post by Developer99 »

If there are certain conditions in my task, I would like to manually raise an actual error that would stop the script or run a error handler and pass the error variables to it.It would be nice if I wrote an ERROR type message to the log with Log Message that an error would be raised and the task proceed as it would in the case of any other error in a task.Is this clear?Thanks.
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Raise an error manually

Post by Oleg »

You always can start handler task with parameters:
LastErrorTaskID={TaskID}
LastErrorTaskName={TaskName}
LastErrorTaskExternalName={TaskExtName}
LastErrorStep=<Write something>
LastErrorCode=<Write something>
LastErrorDescription=<Write something>

put into your task such code:
if some_condition then
   Start task (handler task with parameters)
   Stop task (this task)
end if
Developer99
Posts: 6
Joined: Wed Jan 23, 2013 3:01 pm
Location: United States

Raise an error manually

Post by Developer99 »

Ok. I did do something kind of like that but used different variables.  I didn't know if the LastError... variables were writable.Thanks for tip, Oleg.
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Raise an error manually

Post by Oleg »

LastErrorTaskID, LastErrorTaskName, LastErrorTaskExternalName, LastErrorStep, LastErrorCode, LastErrorDescription are parameters of error handling task.
Read more here.
RoboTask passes these parameters automatically on error.

Of course you can start error handling task with the same parameters or with your own parameters.
Error handling task is the same as other tasks.
Post Reply