1

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

}
Sunil
  • 18,294
  • 25
  • 99
  • 171
  • Did you try it out? What did it do? See also [How to use ELMAH to manually log errors](http://stackoverflow.com/questions/7441062/how-to-use-elmah-to-manually-log-errors) – mason Feb 24 '14 at 21:47

1 Answers1

2

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.

ThomasArdal
  • 4,314
  • 4
  • 22
  • 50