How to pass xaml file name in exception

Hello,

I want to pass the xaml file name along with the exception getting raised in the file. How to achieve this?

I dont want to use throw. Want to capture the xaml file name for any exception.

1 Like

You may want to check this out. There is an example that shows how the code captures the currently executing file path and name.

I hope this helps

@Sumit_Ghosh1

I guess Exception.Source will give the Workflow file name.

           Exception.Source

Not getting from the link how my requirement met?

Exception.source gives the source activities details but not the xaml info.

Well if you want the name of the file from where the exception originates, that link demonstrates how a .cs class contains code that captures the name of the .cs file from where the code runs.

So, you have to implement something similar to capture the .xaml name in the Try_Catch construct.

Hi @Sumit_Ghosh1

Try using try catch for all the workflows and in each workflow catch part you can update which workflow is getting faulted.

It is static but will work.

Thanks

Fine
Whenever you are creating a workflow or a sequence in a xaml file create a very first Local variable using a assign activity with the xaml name

Now this variable will have the xaml name

So when you are trying to catch exception of a activity, probably the one you would have surrounded with TRY CATCH activity use this local variable as a part of your message

This is one easy way as exception.source or message won’t give the xaml name rather it will give only the activity name

I think this would help us in this scenario as simple as possible

Cheers @Sumit_Ghosh1

1 Like

Agreed. In short you have to pass the xaml name as argument across the workflow calls.

I thought if there could be a way where i can include the xaml name variable to the exception.message.

I think this way it can be acheived

Sysexception = exception.message + xaml variable name

Yeah exactly if you want to have it logged in the workflows been invoked then it has to be sent as in argument to it

And that would work as a simple workaround

Cheers @Sumit_Ghosh1

Do you have any further queries on this topic to discuss
@Sumit_Ghosh1

thanks

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.