Class: Response::RaiseRapidashError

Inherits:
Middleware
  • Object
show all
Defined in:
lib/faraday/response/raise_rapidash_error.rb

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object

Raises:

  • (klass)


6
7
8
9
10
# File 'lib/faraday/response/raise_rapidash_error.rb', line 6

def on_complete(env)
  status = env[:status].to_i
  klass = Rapidash.response_exception_class || Rapidash::ResponseError
  raise klass.new(env) if (400..599).include?(status)
end