Class: FaradayMiddleware::RockRMSErrorHandler

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/rock_rms/error.rb

Constant Summary collapse

ERROR_STATUSES =
400..600

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object



9
10
11
12
13
14
# File 'lib/rock_rms/error.rb', line 9

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