Class: ContextIO::Response::RaiseServerError Private
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- ContextIO::Response::RaiseServerError
- Defined in:
- lib/context-io/response/raise_server_error.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Faraday middleware for raising errors on 5xx status codes
Instance Method Summary collapse
-
#on_complete(env) ⇒ void
private
Raise an error if the response has a 5xx status code.
Instance Method Details
#on_complete(env) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Raise an error if the response has a 5xx status code
21 22 23 24 25 26 27 28 |
# File 'lib/context-io/response/raise_server_error.rb', line 21 def on_complete(env) case env[:status].to_i when 500 raise ContextIO::Error::InternalServerError.new('Something is technically wrong.', env[:response_headers]) when 503 raise ContextIO::Error::ServiceUnavailable.new('Could not connect to mail server.', env[:response_headers]) end end |