4

I have been using Elmah for an MVC application and my question is

Is it a bad practice to not write try catch statement when using Elmah?

Arjun Shetty
  • 1,575
  • 1
  • 15
  • 36

1 Answers1

10

ELMAH is used to log unhandled exceptions. If you can handle the exception I would strongly suggest that you do.

If you still want to log the exceptions to ELMAH, you can do so:

try {
  ...
}
catch (Exception e) {
  Elmah.ErrorSignal.FromCurrentContext().Raise(e)
}
Xharze
  • 2,703
  • 2
  • 17
  • 30