Error Handling & Object Cloning

  • 12 September 2022
  • 3 replies

My company has a coding standard that basically requires error handling for object cloning, but I am not really sure how to implement the Error Handling command to account for every single object cloning instance. Here is my current setup:cloningEHThe Error Handling command only has options to "continue" or "stop task".. if I select Continue but the object clone fails, the bot fails entirely so I don't see how Error Handling will help. If I choose Stop Task, I don't really want it to Stop.. I want it to close everything and restart from line 1.


All of the object cloning commands are inside of a loop. Am I supposed to make each object clone a sub task and write "if task fails then .." ? that seems incredibly inefficient and possibly cause more issues than leaving it as is.



3 replies

Hi @Phillip Graves​ ,

Below are the steps that will help you to achieve restarting of the application incase if an error:

  1. Create two tasks (Parent and Child), Child task will have all the steps. In your case, the object cloning task is a child task.
    1. In Child Task, Under Error Handling, Check Variable Assignment Checkbox, set the value of a variable as True (Now, incase of an error, the value of this variable will set to True (lets say variable name is isError_bool), you might want to turn on other options as well)image
  2. From Parent Task, Drag and Drop Loop > Times 3 (considering you want to retry three times incase of any error in child task) > Inside the loop
    1. Set the value of isError_bool to False
    2. Call the Child task using run task command, make sure you are mapping the isError_bool variable
    3. If ($Counter$ = 3) and (isError_bool = True)
      1. Here bot tried 3 times but still not able to perform the required activities, in this case you might want to send an email, take necessary screenshot and add logs to log files.
    4. Else If (isError_bool = False)
      1. Exist the loop - In this case there is no error in child bot
    5. Else
      1. You might want to create another task that will close the application so that in the next loop run, bot can retry as there is an error occurred in the current run


Please let me know if this answers your question.



Ikshit Dhawan




If I understand correctly, the Parent task is basically a shell, and all the object cloning and other code could be its own subtask. So instead of breaking up the code starting at the object cloning.. couldn't I just make a new task that has the steps listed under "2", and just do a "run task" that includes all the other code I've already written + new error handling?

Yes, please make sure that all the object cloning commands are under the Error Handling as show in the screenshot.


FYI - When an error occurs in the error handling, There are two system variable which will precisely tell in what line number the error occurred along with error description.

System Variables are - Error Line Number and Error Description