Pergunta

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

}
Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top