PureDevelopers
IS-IT--Management
I wrote a custom error handler class that is supposed to insert the error info into the database when an error occurs, but when I call it from a catch block all I get is the generic error page and no insert. Is there something I need else I need to do in addition to adding a try block to trap errrors?
try
{
//throwing error on purpose
int i = null;
}
catch (Exception ex)
{
ErrorHandler.HandleError(ex, "Sorry, we are experiencing a problem with our photo galleries. Our site administrator has been notified.");
}
The ErrorHandler.HandleError method is being ignored, and the page is just throwing an error. I thought the whole idea was to trap the error and handle it. Do I have to clear the error or something. I don't want the user to see the error page. I want to insert the error info into the database and send the user to a friendly page.
try
{
//throwing error on purpose
int i = null;
}
catch (Exception ex)
{
ErrorHandler.HandleError(ex, "Sorry, we are experiencing a problem with our photo galleries. Our site administrator has been notified.");
}
The ErrorHandler.HandleError method is being ignored, and the page is just throwing an error. I thought the whole idea was to trap the error and handle it. Do I have to clear the error or something. I don't want the user to see the error page. I want to insert the error info into the database and send the user to a friendly page.