Skip to main content

Hi to all! This is my first post here. I’m new in this platform but I’m I have been working on other platforms such as UiPath and BluePrism for years.

 

I’m not sure is this a bug or that’s how it works because it doesn’t makes sense to me:

  1. I have PARENT bot and a CHILD bot.
  2. In CHILD bot I defined an output variable ‘out_childVar_str’ (output checked)
  3. I have mapped this variable with an appropriate variable in the PARENT bot (parentVar_str).
  1. In a Child bot I assign a value to a variable ‘out_childVar_str’.
  1. After that assign action, I simulate an error with a throw then bubble that error to a Parent bot
  2. NOW...my problem is that parent variable (parentVar_str) has not getting the value from the mapped Child bot variable (out_childVar_str)

 

When I go through the child bot without a simulated error, the parent variable gets populated with the value from the child bot variable as it should be.

But with the simulated error this just not working. Please help me with this one!

 

Thank you!

 

Welcome ​@dean.hubak to the Automation Anywhere family!

I think where you're getting hung up is in the Throw actions. If you use a Throw in a Try block, it simulates the error. If you use a Throw in the Catch block, it should terminate the Try/Catch, which is not what you want to do. 

If you remove the Throw in the Catch, it should be able to pass the value back to the parent. 


Thank you for your response ​@Aaron.Gleason

I understand that it works when there’s no Throw action within the Catch part...I have tried that.

But then, how to:

  1. Bubble up (rethrow) an exception from a Child bot to Parent with all the info about an error in child bot in it + my personal inputs (in case we need that kind of error message info in Parent...in 99% we need that) and
  1. at the same time transfer all the values from other output variables, that child bot has collected, to the Parent bot mapped variables?

My logic was:

  1. Catch the error in child bot
  2. Put error details (Child’s errorMessage, lineNumber) + info that I want in ‘errorDetailsVariable’.
  3. (Re)throw with all the info from the ‘errorDetailsVariable’
  4. Catch that error in Parent bot and process it…

 


@dean.hubak The Catch action allows you to assign error information to an “Error Message” string and an “Error Line Number” integer. Those values can be assigned to variables that can be marked as output.

Then, when flow returns to the parent, you can check if the “Error Line Number” value is greater than zero. If so, an error occurred. 

Here’s my parent bot:
 

I used your variable naming scheme for clarity

Here’s my child bot:

When I run the parent bot, it displays a message box with 123 in it.

I hope this clarifies things.


Thank you ​@Aaron.Gleason , thats one way to do that. I just want to follow best practices ;)


@dean.hubak These are best practices for Automation Anywhere. I’m a trainer here.  😉


@dean.hubak These are best practices for Automation Anywhere. I’m a trainer here.  😉

Ok...so you can explain my next question/observation regarding this issue 😉

Much thank you, ​@Aaron.Gleason 


This is my new version of the Child bot...as you see, I removed the throw action form the Catch part and put it in the Finally section

 

 

Still yet, my Child’s output variables are still blank in mapped parent var’s after Child is throwing that second error at the bottom.

 

 

 

I have also tried to move IF outside Finally section...still got the same results.

 


@dean.hubak I’m not sure why you’re using Throws outside of a Try, but that’s not best practice.

If you run your child bot directly, you’ll notice the automation will throw an error at step 12. Throws outside of a Try will cause the automation to stop prematurely and/or display an error. 


@Aaron.Gleason, thank you for your effort!

 

I understand that...if you are looking only the Child bot...but there is also a Parent bot :)

 I’m just trying to figure out the easiest way to collect the information what happened in a Child bot (errorLineNumber, errorMessage) and add my personal comment into that exception and pass it to the Parent bot.

 

Thats why I’m using an ‘Assign: String’ action (into errorMessage variable) in line 9 of a Child bot - to collect all the information about the error in the Child bot and customize my error message with more personalized detail. It would look like this:

kTEST - CHILD, 7]: Error details

 

Then I would use that personalized errorMessage variable mentioned above in that Throw (line 12) to rethrow/pass it to a Parent bot in one step so it can be handled there.

 

 

In Parent bot, I would use a log action instead of Message box (which is there only for reading the error message while I’m testing it) so I can log an error in a Parent bot that would look something like this:

timeStamp; ERROR; oTEST - Parent, 2] RTEST - Child, 7] - Error text

 

In that way I would know the exact place and reason for which Child bot failed, and also where exact the Parent bot caught the error (ParentErrorLineNumber)...or in other words, at what line Child bot was called (because Parent bot would be a sort of Main Task bot which can be stacked with many lines of code)

I just trying to output as less number of Child’s output variables (such as lineNumber) and don’t deal with them after the process is continued in Parent bot (as in your example).

 

I hope that is clear enough what I’m trying to say :)

 

But...lets get to the the main problem...if i Rethrow the error message in Child bot (line 12), even that Throw action is outside the Catch part (as you suggested it), other output variables of a Child bot are not go to the mapped Parent variables. I wonder why is that so?


Hey ​@dean.hubak, I guess I wasn't as clear as I should have been. I created two output variables: out_ErrorMessage_str and out_ErrorLineNumber_num (trying to replicate your naming scheme) and assigning them in the Catch action itself. That will report what error happened in the child to the parent. All the parent has to do is look at the two variables assigned by the Catch action. 

 

The Throw action (if you even need one) should only be used in the Try. Not the Catch. Not the Finally. Those will cause unexpected problems. 

 

You can replace the Throw in the Try with something like a CSV: Close to close an unopened file (which will obviously cause an error). I hope that makes sense.


Thank you ​@Aaron.Gleason for your effort!

As I said before...I’m new in this platform but I have an experience in other platforms.

I find it very unpractical that if error occur in Child bot that has NO Try block, that the information collected during it’s execution and before an error (out_childVar) don’t get transferred to a mapped Parent variable (parentVar_str) when the Parent bot catches the Child error.

 

Same goes in case when Child error has not handled properly through it’s own Try block.

 

But thats how it is, obviously...

 

Than you, ​@Aaron.Gleason once again for every second of your effort


@dean.hubak Every platform and programming language has its quirks. This is one of ours. Another is that we can have a Try block without a Catch!

Please feel free to tag me for any other questions you may have. Enjoy your weekend!


@dean.hubak This does not seem intended, try recreating fresh parent child file and their mapping.

Other option is to pass dictionary as input and update the key-value - they are passed by reference.


Reply