1

I've written a custom notification to Airbrake from a Ruby EM server we run along with our Rails app. In the case of an exception, I notify Airbrake as per the API docs

 Airbrake.notify(
    :error_class   => "Ruby EM Server Error:",
    :error_message => "EM Server Crashed with error: #{$!}",
    :backtrace    => $@,
  ) if ENV['RAILS_ENV'] == 'production'

However, when the error comes through as "Unknown: EM Server Crashed with error:"

I know what the RAILS_ENV is when I send off the notification so I was wondering if there was any way I can pass this info on to Airbrake without writing XML and posting it.

I'd like to see the error to come through as "Production: EM Server Crashed with error:"

Ganesh Shankar
  • 4,826
  • 8
  • 43
  • 56

1 Answers1

6

Try this:

 Airbrake.notify(
    :error_class      => "Ruby EM Server Error:",
    :error_message    => "EM Server Crashed with error: #{$!}",
    :backtrace        => $@,
    :environment_name => ENV['RAILS_ENV']
  ) if ENV['RAILS_ENV'] == 'production'

The environment_name option is in the gem's documentation.

Mark Thomas
  • 37,131
  • 11
  • 74
  • 101