Try Catch Printing Exception Source

studio
logs

#1

I have an activity to click image if it cannot find the image it throws an exception and source field in the exception pop up tells me exactly which image(My Display name) is throwing the exception.But when I catch that exception, exception.source property gives me system.activities as an Output.

How to get the exact source Any Ideas??


How to display Process Name and Main Xaml and Error activity name and error flow name
Try/Catch - exact source of exception is not shown
#2

Try exception.Tostring or exception.Message.


Need inforrmation about Timeout error
#3

Both Try exception.Tostring or exception.Message says Image not found.It doesn’t say explicitly which Image


Exception Handling example
#4

True. It seems to be a bug.I think you can capture the Displayname in a variable or hardcode in that specific exception.

@badita can you help


Uninformative error message
#5

yes, check this here. Logging.zip (7.6 KB)

Only that it works only if the error occurs in an invoked workflow.

Therefore

  • do your actions in wf1
  • in main add try {invoke wf1;} catch(exception ex) {log ex.source};
  • run main

and it will work.


How to get Exception source "Activity Description name"
How to get a display name of activity that gave error using try catch
Exception Handling example
Killing a process if a job failed
Exception Location
Exception Location
Catch every error inside a workflow
Try/Catch - exact source of exception is not shown
#6

Thanks @badita. It worked.


Obtain Sequence's DisplayName
#7

So what you are saying is, if we want to have the name of the activity, we need to have all error handling in another workflow, like:

workflow: RUNME
try{
invoke main }
catch all exceptions{
Print activity name}

Is there really not smarter solution?
If not, could there be an option when starting a new project to automatically generate a file with above content?


#8

Hi badita,

I appreciate your sharing knowledge for logging exception.source.

Couldn’t we log exception source when we use only 1 workflow which don’t have [Invoke workflow] ?

Regards,
Soshi


#9

As of now…no. We are limited by the WF technology.


#10

Thanks.


#11

Hi @badita,
This solution provides us the activity name in which the exception occured.
But if I have multiple files how can I know in which file this exception occured?

Is there any solution for us to know both the below things.

  • I want to know activity name in which the exception occured
  • Also I want to know the file name in which the exception occured.

Could you help on this?

Regards,
Sree


#12

It might be helpful to store like a destination variable before each Invoke, so you know where it is in the process. Then you can use that to know which part of the process failed and attach that with the Source and Message. However, depending on your framework, if your Try/Catch is outside of your entire process, then that destination variable will not get stored through the Arguments since Arguments are not passed in the event of an Exception, unless you maybe store your destination in a file.