Try/Catch Debugging

I am using a try/catch block to catch errors that occur in my code and it is working well. The problem is that because the code is in a try/catch block, the error/reason that caused it to fail (like it could not find a click or an object reference was not set) does not appear in the output anymore, which makes it harder to find the problem.

Is there a way to make this still appear? Is it as simple as writing out the exception as a string? Thanks

You could write exception.Message and exception.Source to the output to see the error. However, generally you would want errors to stop the process, since an error indicates that something went wrong and the process needs to stop.

2 Likes

Yes I do want it to stop the process I just wanted to be able to see what went wrong in the output. But I believe writing out the exception has solved that. Thanks