6

I have Airbrake installed on my Rails app. However, I also want to perform some other actions when a 500 occurs. How do I rescue 500 errors without interfering with Airbrake?

bevanb
  • 8,201
  • 10
  • 53
  • 90

1 Answers1

9

One way you can do this in your ApplicationController, you can put

unless Rails.application.config.consider_all_requests_local
  rescue_from Exception, with: :render_500
end

and later, a new render_500 method

def render_500(ex)
  notify_airbrake(ex)
  # render your template/message
end
deefour
  • 34,974
  • 7
  • 97
  • 90