How can i catch all type of Exceptions (Business & Application etc) and store in a excel sheet?

I have 3/4 workflows (.xaml files) and i want to catch all the exceptions from all workflows and store in a excel sheet like - Date & Time, Log Message, workflow name and serial no. etc… Can any body please help me or if possible can any one make a xaml file and send to me…

Thank you

@mitradev_das You would need to Create a Datatable with those Column names. Then in Catch Blocks you can use a Add Datarow Activity and use item array Property to provide the Error Values using exception variable to add values to that Datatable and then at the End you can Write the Datatable to an Excel File.

1 Like

Yes, you are right but i want to catch multiple type exceptions like (BusinessRuleExceptions, ApplicationException and etc…). So how can i catch those with workflow name, date, exception message…?

Beforehand, I should tell you that System.Exception is the parent (root) exception class which you can capture any exception that’s raised within the Try Catch block.

But as a beter guidance since you have multiple workflows, add a Global Handler which is a global exception catcher for the whole project. Wherever you want to raise an exception manually based on a condition, use Throw activity. Put your desired tracing info in Throw’s Exception field to later capture and process that with the global handler.
Use this link to better understand how to deal with Throw activity: How to use Throw and ReThrow - #5 by AndrewRayner

Also, consult the official docs both for Throw and Global Handler.

1 Like

I want to write the Exception to a datatable,I have assigned the exception that i caught in the catch box to a variable of type system.exception…How do I write this to my datatable?