class Airbrake::Filters::ExceptionAttributesFilter
ExceptionAttributesFilter
attempts to call `#to_airbrake` on the stashed exception and attaches returned data to the notice object.
@api private @since v2.10.0
Public Class Methods
new()
click to toggle source
# File lib/airbrake-ruby/filters/exception_attributes_filter.rb, line 11 def initialize @weight = 118 end
Public Instance Methods
call(notice)
click to toggle source
@macro call_filter
# File lib/airbrake-ruby/filters/exception_attributes_filter.rb, line 16 def call(notice) exception = notice.stash[:exception] return unless exception.respond_to?(:to_airbrake) attributes = nil begin attributes = exception.to_airbrake rescue StandardError => ex logger.error( "#{LOG_LABEL} #{exception.class}#to_airbrake failed. #{ex.class}: #{ex}", ) end unless attributes.is_a?(Hash) logger.error( "#{LOG_LABEL} #{self.class}: wanted Hash, got #{attributes.class}", ) return end attributes.each do |key, attrs| if notice[key] notice[key].merge!(attrs) else notice[key] = attrs end end end