質問

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

}
役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top