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.
20 21 22 23 |
# File 'lib/faraday/raise_http_5xx.rb', line 20 def initialize(app) super @parser = nil end |
Class Method Details
.register_on_complete(env) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/faraday/raise_http_5xx.rb', line 7 def self.register_on_complete(env) env[:response].on_complete do |response| case response[:status].to_i when 500 raise Tweetsentiments::InternalServerError, (response, "Something is technically wrong.") when 502 raise Tweetsentiments::BadGateway, (response, "Tweetsentiments is down or being upgraded.") when 503 raise Tweetsentiments::ServiceUnavailable, (response, "(__-){ Twitter is over capacity.") end end end |