Individual message for error-handling-task?

Discuss RoboTask here
Post Reply
userXXX
Posts: 58
Joined: Wed Jun 11, 2014 8:45 am

Individual message for error-handling-task?

Post by userXXX »

Hello,
is it possible to set an individual message for the error-handling-task additional to the system variables?

Example:
Task X is a kind of subtask, e. g. parsing and executing SQLs which where transfered by any other task (maintask).
Now task X gets an error and the error-handling-task gives me the information that task X got an error. Because every of my maintasks could have started task X it's very difficult to find out, which task sent the wrong SQL causing the error.

I would like to pass the name of the calling task to the subtask and use it there for the error-handling-task.

Any idea how to do that?

Thanks.
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Individual message for error-handling-task?

Post by Oleg »

When RoboTask run the "error handling" task it pass to this task parameters:
  • LastErrorTaskID – the internal ID of the task, in which an error was raised. It is a formal identifier of the task like a number.
  • LastErrorTaskName - the name of the task, in which an error was raised.
  • LastErrorTaskExternalName – an External Name of the task, in which an error was raised.
  • LastErrorStep – the number of the step (starting from 1), in which an error was raised.
  • LastErrorCode – code of the error. There is the own kit of codes of errors for any type of actions (see description of actions). By default – 0.
  • LastErrorDescription – the description of the error. It depends on a type of action. By default, it is the line "General error".
You can read this here: http://www.robotask.com/help/index.php? ... essing.htm
and here: http://www.robotask.com/help/index.php?tasknew.htm

Code: Select all

So you can make such error handling task
If {LastErrorTaskExternalName} = task1 then
	Send  message1
elseif {LastErrorTaskExternalName} = task2 then
	Send  message2
elseif {LastErrorTaskExternalName} = task3 then
	Send  message3
else
	Send  default message
end if
You can see and change external name of the task here (see screenshot below). External name the alternative identifier of the task. It is unique.
extname.png
extname.png (57.76 KiB) Viewed 17274 times
Oleg Yershov
userXXX
Posts: 58
Joined: Wed Jun 11, 2014 8:45 am

Re: Individual message for error-handling-task?

Post by userXXX »

Hello Oleg,

thank you for your support.
I checked your links but unfortunately they couldn't help me in that question.

Using your example:

There are dozens of (main-)tasks, which each starts (sub-)task "Send Email..." sometimes.
If task "Send Email..." causes an error and an error handling task would be called, {LastErrorTaskExternalName} would report an error in task "SendMailTask1".
This info would be right but not very helpful as long as I don't know which one of my dozens of tasks started task "Send Email..." at this time.

It would be useful to pass an individual message via parameter to another (sub-)task, which would then automatically routed through to the error handling task in case of an error. Somethink like that.... ;)
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Individual message for error-handling-task?

Post by Oleg »

Do you want to know the parent task?

You can set some global variable when you start "Send email" task (For example CallerOfSendMail).
Put the assigning the empty value to this variable at the end of "Send email" task.

Thereby, if you receive an error in "Send email" task the global variable CallerOfSendMail will contain some value and you can identify the parent task.
Oleg Yershov
userXXX
Posts: 58
Joined: Wed Jun 11, 2014 8:45 am

Re: Individual message for error-handling-task?

Post by userXXX »

Very good idea :!:
I'll try this.
Post Reply