Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rescue 500 error without messing Airbrake up

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?

like image 425
bevanb Avatar asked Nov 22 '12 12:11

bevanb


1 Answers

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
like image 97
deefour Avatar answered Nov 07 '22 00:11

deefour