class Namira::ErrorHelpers::Bugsnag

Public Class Methods

new(bugsnag) click to toggle source
# File lib/namira/error_helpers.rb, line 12
def initialize(bugsnag)
  @bugsnag = bugsnag
end

Public Instance Methods

call(notification) click to toggle source
# File lib/namira/error_helpers.rb, line 16
def call(notification)
  notification.exceptions.each do |exception|
    next unless exception.is_a?(Namira::Errors::HTTPError)

    notification.add_tab("Namira #{exception.response.status.to_i}",
      headers: exception.response.headers.to_h,
      body: exception.response.body.to_s[0...200],
      method: exception.response.method.to_s,
      url: exception.response.url.to_s,
      redirected: (exception.response.redirect_count > 0).to_s)
  end

  @bugsnag.call(notification)
end