Sha256: 2c4de74d3ccbb5453d4f2aaa5feee0665be2df0a400252321e64c05ca9216f21

Contents?: true

Size: 375 Bytes

Versions: 14

Compression:

Stored size: 375 Bytes

Contents

require 'faraday'

module AirbrakeAPI
  module Middleware
    class RaiseResponseError < Faraday::Response::Middleware

      def on_complete(env)
        raise AirbrakeError.new('No results found.') if env[:body].nil?

        if env[:body].errors && env[:body].errors.error
          raise AirbrakeError.new(env[:body].errors.error)
        end
      end

    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
airbrake-api-4.6.1 lib/airbrake-api/middleware/raise_response_error.rb
airbrake-api-4.6.0 lib/airbrake-api/middleware/raise_response_error.rb
airbrake-api-4.5.1 lib/airbrake-api/middleware/raise_response_error.rb
airbrake-api-4.5.0 lib/airbrake-api/middleware/raise_response_error.rb
airbrake-api-4.4.0 lib/airbrake-api/middleware/raise_response_error.rb
airbrake-api-4.3.0 lib/airbrake-api/middleware/raise_response_error.rb
airbrake-api-4.2.2 lib/airbrake-api/middleware/raise_response_error.rb
airbrake-api-4.2.1 lib/airbrake-api/middleware/raise_response_error.rb
airbrake-api-4.2.0 lib/airbrake-api/middleware/raise_response_error.rb
airbrake-api-4.1.3 lib/airbrake-api/middleware/raise_response_error.rb
airbrake-api-4.1.2 lib/airbrake-api/middleware/raise_response_error.rb
airbrake-api-4.1.1 lib/airbrake-api/middleware/raise_response_error.rb
airbrake-api-4.1.0 lib/airbrake-api/middleware/raise_response_error.rb
airbrake-api-4.0.0 lib/airbrake-api/middleware/raise_response_error.rb