Writing to debug log
-
I have some code within try...catch blocks that might not always execute properly. One error that might occur is a System.InvalidCastException error. I trap the error, but can I prevent the error from being written to the log? Thanks
-
I have some code within try...catch blocks that might not always execute properly. One error that might occur is a System.InvalidCastException error. I trap the error, but can I prevent the error from being written to the log? Thanks
:confused: :confused: And who is writing those exceptions to the log? remove the code that does that. Or, much better, do what it takes not to have those casting exceptions in the first place (can't provide detailed help witout seeing the offensive code).
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
-
I have some code within try...catch blocks that might not always execute properly. One error that might occur is a System.InvalidCastException error. I trap the error, but can I prevent the error from being written to the log? Thanks
Catch the specific Exceptions first, then the generic Exception:
Try
'some code
Catch System.InvalidCastException
'do something
Catch Exception
'log it and do something
End TryBut of course you should better find the reason for those InvalidCastException, and get rid of them.