Sha256: ff155d593a02089dc5388b380261657cb3814f610749158d6a1ff0a08c5f1b2b

Contents?: true

Size: 368 Bytes

Versions: 7

Compression:

Stored size: 368 Bytes

Contents

module RockRMS
  class Error < StandardError; end
end

require 'faraday'
module FaradayMiddleware
  class RockRMSErrorHandler < Faraday::Response::Middleware
    ERROR_STATUSES = 400..600

    def on_complete(env)
      case env[:status]
      when ERROR_STATUSES
        raise RockRMS::Error, "#{env[:status]}: #{env[:body]} #{env[:url]}"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rock_rms-4.18.0 lib/rock_rms/error.rb
rock_rms-4.17.0 lib/rock_rms/error.rb
rock_rms-4.16.0 lib/rock_rms/error.rb
rock_rms-4.15.0 lib/rock_rms/error.rb
rock_rms-4.14.0 lib/rock_rms/error.rb
rock_rms-4.13.0 lib/rock_rms/error.rb
rock_rms-4.12.3 lib/rock_rms/error.rb