문제

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