lib/airbrake.rb in airbrake-3.0.rc1 vs lib/airbrake.rb in airbrake-3.0.rc2
- old
+ new
@@ -18,11 +18,11 @@
require 'airbrake/railtie' if defined?(Rails::Railtie)
# Gem for applications to automatically post errors to the Airbrake of their choice.
module Airbrake
- API_VERSION = "2.0"
+ API_VERSION = "2.2"
LOG_PREFIX = "** [Airbrake] "
HEADERS = {
'Content-type' => 'text/xml',
'Accept' => 'text/xml, application/xml'
@@ -130,11 +130,14 @@
end
end
def build_notice_for(exception, opts = {})
exception = unwrap_exception(exception)
- opts = opts.merge(:exception => exception)
- opts = opts.merge(exception.to_hash) if exception.respond_to?(:to_hash)
+ if exception.respond_to?(:to_hash)
+ opts = opts.merge(exception.to_hash)
+ else
+ opts = opts.merge(:exception => exception)
+ end
Notice.new(configuration.merge(opts))
end
def unwrap_exception(exception)
if exception.respond_to?(:original_exception)