Proper error handling for child tasks

Discuss RoboTask here
Post Reply
brendenguy
Posts: 1
Joined: Wed Jun 27, 2018 3:18 am

Proper error handling for child tasks

Post by brendenguy »

I am currently evaluating RoboTask and have run into some problems with error handling, specifically around tasks that are started from other tasks. I have written a large number of tasks which use other tasks and global variables for parts of their executions. I have noticed that when a child task encounters an error, the parent task that started it continues on as if nothing had happened. I need for every task up the chain to stop when this occurs and I do not know the best way to do this. I did not find any way to kill all tasks or even to kill a parent task without knowing its name. I noticed that you can access the details of the last error, but I am not sure how to handle this information in the parent task.

What I've been attempting to do so far is write an error handling task that attempts to end all other tasks, but this seems like a very inelegant and hacky solution. I'm hoping there is another way to do this that I've missed. Can anyone help clarify how this works?

Thanks in advance!
Oleg
Site Admin
Posts: 2785
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Proper error handling for child tasks

Post by Oleg »

did not find any way to kill all tasks or even to kill a parent task without knowing its name.
Child task don't know who launched the task.
What I've been attempting to do so far is write an error handling task that attempts to end all other tasks, but this seems like a very inelegant and hacky solution.
You don't need to stop all tasks. You should know (as author) what tasks can be the parent tasks for this task. Stop them only.

Another solution
If you run other task with waiting for finish option you can do this
  • Set some global variable to 0 before Start task.
  • The last step of child task should set this variable to 1 (for example). This mean that the task finished successfully
  • You should analyse this variable when child task finished. If it is 0 then child task get an error, if 1 - child task finished successfully
Oleg Yershov
Post Reply