Class: Response::RaiseHttp5xx
- Inherits:
-
Middleware
- Object
- Middleware
- Response::RaiseHttp5xx
- Defined in:
- lib/faraday/raise_http_5xx.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(app) ⇒ RaiseHttp5xx
constructor
A new instance of RaiseHttp5xx.
Constructor Details
#initialize(app) ⇒ RaiseHttp5xx
Returns a new instance of RaiseHttp5xx.
18 19 20 21 |
# File 'lib/faraday/raise_http_5xx.rb', line 18 def initialize(app) super @parser = nil end |
Class Method Details
.register_on_complete(env) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/faraday/raise_http_5xx.rb', line 5 def self.register_on_complete(env) env[:response].on_complete do |response| case response[:status].to_i when 500 raise BullionVault::InternalServerError, (response, 'Something is technically wrong.') when 502 raise BullionVault::BadGateway, (response, 'BullionVault is down or being upgraded.') when 503 raise BullionVault::ServiceUnavailable, (response, '(__-){ BullionVault is over capacity.') end end end |