Question
3
Replies
4321
Views
Accenture Solutions Pvt Ltd
Posted: April 5, 2017
Last activity: November 6, 2018
Closed
Exception Handling in OpenSpan
HI,
Please provide an example on how to implement try catch for predefined & custom exceptions & to log the exceptions.
Regards,
Pravallika.
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
If you wrap a specific portion of your automation in a Try...Catch and want to catch a specific exception type, you can click the "+" icon at the bottom of the Catch block to add a new Exception to catch. Clicking the "..." icon on this new line will allow you to select the specific exception you want to catch. Exceptions will be logged unless you have disabled logging or have otherwise disabled logging for exceptions (unlikely as that requires deliberate action). If you want to write a specific message to the log, use the DiagnosticsLog component from the Toolbox on the Advanced tab. It has a method called "Log" that accepts a string that could be anything you want to write to the log. My suggestion would be to preface each log message with a specific set of characters ("***LOG - " for example) so that you can easily locate them.