Skip to content

Instantly share code, notes, and snippets.

@4141done
Created October 23, 2012 23:06
Show Gist options
  • Save 4141done/3942360 to your computer and use it in GitHub Desktop.
Save 4141done/3942360 to your computer and use it in GitHub Desktop.
Airbrake Changes
# repo at:
# https://github.com/CityGrid/airbrake
def notify_airbrake(exception, opts={})
unless airbrake_local_request?
Airbrake.notify(exception, airbrake_request_data.merge( :additional_fields => opts ))
end
end
# passes to:
def build_notice_for(exception, opts = {})
custom_fields = {}
exception = unwrap_exception(exception)
if exception.respond_to?(:request)
custom_fields.merge!(
{
"API Request" => exception.request,
"API Response" => exception.response,
"CURL" => exception.curl
}
)
end
if opts[:additional_fields]
custom_fields.merge!(opts[:additional_fields])
opts.delete(:additional_fields)
end
opts = opts.merge(:exception => exception) if exception.is_a?(Exception)
opts = opts.merge(exception.to_hash) if exception.respond_to?(:to_hash)
opts[:parameters] = opts[:parameters].merge(custom_fields)
Notice.new(configuration.merge(opts))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment