Question

I am using ELMAH for logging in ASP.Net app.

My question is will the following line : Elmah.ErrorSignal.FromContext(System.Web.HttpContext.Current).Raise(ex), when used within a catch block throw the exception to the caller or simply log it and send out an error email?

try 
 {
 ...
 }
catch (Exception ex)
{
   Elmah.ErrorSignal.FromContext(System.Web.HttpContext.Current).Raise(ex);

   //do some special processing

}
Was it helpful?

Solution

Your code logs the thrown exception (ex) in ELMAH and returns successful to the caller. In other words, Raise does not throw an exception.

If your catch block re-throws ex or throw a new exception, both ex and the new exception are logged to ELMAH and a status code 500 is returned to the caller.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top