Sha256: c727018425726f0f1a8fe805a26c65846a0c52c4ba76e6de63dd07fea41904c3

Contents?: true

Size: 716 Bytes

Versions: 1

Compression:

Stored size: 716 Bytes

Contents

module RestfulResourceBugsnag
  class Middleware
    def initialize(bugsnag)
      @bugsnag = bugsnag
    end

    def call(notification)
      exception = notification.exceptions.first

      if exception.is_a?(RestfulResource::HttpClient::HttpError)
        notification.add_tab(:response, {
          status: exception.response.status,
          body: exception.response.body,
          headers: exception.response.headers
        })
        notification.add_tab(:request, {
          method: exception.request.method,
          url: exception.request.url,
          accept: exception.request.accept,
          body: exception.request.body
        })
      end
      @bugsnag.call(notification)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restful_resource_bugsnag-0.1.1 lib/restful_resource_bugsnag/middleware.rb