The stack trace is helpful when you are debugging your application. What is not readily apparent is the code you put in place may cause the stack trace to be cleared.
It may be typical for you to write the following error handling:
//C#
try
{
// some code executed here
}
catch (Exception ex)
{
throw ex;
}
'VB
Try
' some code here
Catch ex As Exception
Throw ex
End Try
In the above example, the origin of the exception becomes the line "throw
ex." This hides the real location of the exception, and makes debugging a
guessing game.
The proper way to re-throw an exception is to use the 'Throw' statement with
no exception argument.
//C#
try
{
// some code here
}
catch (Exception ex)
{
throw;
}
'VB
Try
' some code here
Catch
Throw
End Try
Thank you! Thank you! I just finished reading this document, which was part of a link in the recent Buzz newsletter. I have printed it for others to read, especially those skeptical on the powers of Access and its capabilities.
Darren D.
All Our Microsoft Access Products