Sha256: eeed9bc8d8c82732ddc64d6ae1646857587a85d7217d442f3a6613c1320f8756

Contents?: true

Size: 487 Bytes

Versions: 7

Compression:

Stored size: 487 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

        private
        def on_complete(response)
          if error = Bugsnag::Api::Error.from_response(response)
            raise error
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bugsnag-api-2.0.2 lib/bugsnag/api/response/raise_error.rb
bugsnag-api-2.0.1 lib/bugsnag/api/response/raise_error.rb
bugsnag-api-2.0.0 lib/bugsnag/api/response/raise_error.rb
bugsnag-api-1.0.3 lib/bugsnag/api/response/raise_error.rb
bugsnag-api-1.0.2 lib/bugsnag/api/response/raise_error.rb
bugsnag-api-1.0.1 lib/bugsnag/api/response/raise_error.rb
bugsnag-api-1.0.0 lib/bugsnag/api/response/raise_error.rb