How do I make BugSnag report 404 errors

736 views Asked by At

I keep getting 404 errors from people posting bad links to my site content. I realized that BugSnag isn't telling me about it, so how do I configure BugSnag to report 404 errors or throw errors in my rails app when things 404? Also, want the 404 html pages to render without Bugsnag interfering.

2

There are 2 answers

0
rsokz On

I suggest reporting a custom 404 handled error to Bugsnag:

begin
  raise ActionController::RoutingError.new('Not Found')
rescue => e
  Bugsnag.notify(e)
end

More information on Rails 404 errors found here.

0
Katie Lane On

You should be able to do this with Bugsnag. You can detect whether the status= 404, and use Bugsnag.notifyException() to send the error in. Hope this helps.