Feature Request
Capture exception handled through HandleErrorAttribute in MVC application
Current Status:
Completed
Max
Hi,
I am working on implementing Raygun for an ASP.Net MVC application.
I have a HandleErrorAttribute that handles exceptions from various views in the application.
I also have exception handling through Application_Error in Global.asax
After implementing Raygun, it captures exceptions caught through Global.asax and exceptions caught through HandleErrorAttribute are not being caught.
Please let me know if this feature is available and how can I enable Raygun to catch exceptions handled through HandleErrorAttribute also.
Thanks in advance.
Raygun
Jason Fauchelle
Posted on
Oct 14 2015
Hi Max,
Raygun4Net can support reporting exceptions caught by HandleErrorAttribute.
The first thing to do is make sure you've installed the correct NuGet packagae. The one you'll want is the Mindscape.Raygun4Net.Mvc package. This is the same as the standard package, but adds this MVC specific support. By setting it up via the module in Web.config ( which you're probably currently doing), a special FilterAttribute will automatically be registered beside the HandleErrorAttribute. Any exceptions that get caught by the HandleErrorAttribute will also pass through the Raygun filter and get logged to Raygun.
Hope that helps! Let me know how it goes.
?-Jason Fauchelle
Jaime
Posted on
Aug 11 2017
Hello,
Does this mean that I should see a new filter.Add(...) in RegisterGlobalFilters? "...a special FilterAttribute will automatically be registered beside the HandleErrorAttribute..."
I have tried with a new MVC project in VS 2015.
I have come to this forum question because I had ELMAH MVC in my project and cannot make both Raygun and ELMAH live together, catching both all the exceptions, without having to manually signal the errors for Raygun with
try {
} catch (Exception e) { new RaygunClient().SendInBackground(e); }
or
protected void Application_Error() { var exception = Server.GetLastError(); new RaygunClient().Send(exception); }
Is this possible? I wouldn't like to disable ELMAH whilst testing Raygun.
Thanks,
Jaime