3

In airbrake controller this code works (gives notification) rescue => ex Airbrake.notify but

rescue => ex
    notify_airbrake(ex)
end

Doesn't give a any airbrake notification.how to make notify_airbrake(ex) to work

Daniel
  • 7,006
  • 7
  • 43
  • 49
Anand Kumar
  • 227
  • 1
  • 4
  • 8

2 Answers2

3

You're probably testing that in your development environment. Add this to your airbrake.rb and it should work.

config.development_environments = []

shime
  • 8,746
  • 1
  • 30
  • 51
1

The implementation of notify_airbrake ignores local request. So if you try to use this method in development you're out of luck. No matter what you've defined in your Airbrake config.

So you could set consider_all_requests_local = false, which is properly not what you want.

Instead you can use airbrake_request_data to get the same result if you don't want to pick the params by yourself.

rescue => ex
  Airbrake.notify(ex, airbrake_request_data)
  redirect_to root_url
end

Hope this helps!

blindgaenger
  • 2,030
  • 2
  • 16
  • 10
  • it matters, `notify_airbrake` checks if the current environment is inside `Airbrake::Configuration.development_environments`. if you put `development_environments` to empty array, it will send the notification no matter what. we have also changed the implementation of `Airbrake::ControllerMethods#notify_airbrake` to check for ignored agents. That will be released in *3.1.7*. – shime Dec 13 '12 at 19:29