I am reading the section titled "Notifying the User" and there is an example such as:
try
{
// run code
}
catch(Exception ex)
{
bool rethrow = ExceptionPolicy.HandleException(ex, "Global Policy");
if (rethrow)
throw;
}
If I try that I get the following error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 105: if (rethrow)
Line 106: //throw new Exception(ex.ToString());
Line 107: throw;
Line 108: }
|
If I do this:
catch(Exception ex)
{
bool rethrow = ExceptionPolicy.HandleException(ex, "DTS Exception Policy");
if (rethrow)
throw new Exception(ex.ToString());
}
Then I get the detailed info from the exception wrote to the screen. My question is in two parts.
First, am I in fact doing this correctly?
Second, what is the best method of providing a user friendly message versus the detailed exception?
Steven M. Swafford
http://www.radicaldevelopment.net
http://www.blog.radicaldevelopment.net/
http://aspalliance.com/author.aspx?uId=1158
Dont forget to click "Mark as Answer" on the post that helped you.