Class: Faraday::PlazucchiniErrors
- Inherits:
-
Middleware
- Object
- Middleware
- Faraday::PlazucchiniErrors
- Defined in:
- lib/plazucchini/faraday.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Middleware
Instance Method Summary collapse
Instance Method Details
#error_message ⇒ Object
25 26 27 |
# File 'lib/plazucchini/faraday.rb', line 25 def "#{@env[:method].to_s.upcase} #{@env[:url]}: #{@env[:status]} - #{@env[:body]}" end |
#on_complete(env) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/plazucchini/faraday.rb', line 7 def on_complete(env) @env = env case env[:status] when 400 raise Plazucchini::RequestError, when 401 raise Plazucchini::Unauthorized, when 404 raise Plazucchini::NotFound, when 500 raise Plazucchini::InternalServerError, when 502 raise Plazucchini::BadGateway, when 503 raise Plazucchini::ServiceUnavailable, end end |