Sha256: 669ed2d39c75cd282eb662f8d04da6d4e3ea4c5b6caca95da336b0db147c8801

Contents?: true

Size: 470 Bytes

Versions: 3

Compression:

Stored size: 470 Bytes

Contents

require "faraday"
require "bugsnag/api/error"

module Bugsnag
  module Api
    # Faraday response middleware
    module Response

      # This class raises an Bugsnag-flavored exception based
      # HTTP status codes returned by the API
      class RaiseError < Faraday::Response::Middleware
        def on_complete(response)
          if error = Bugsnag::Api::Error.from_response(response)
            raise error
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bugsnag-api-2.1.1 lib/bugsnag/api/response/raise_error.rb
bugsnag-api-2.1.0 lib/bugsnag/api/response/raise_error.rb
bugsnag-api-2.0.3 lib/bugsnag/api/response/raise_error.rb