Class: Telleroo::Response::RaiseServerError
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- Telleroo::Response::RaiseServerError
- Defined in:
- lib/telleroo/response/raise_server_error.rb
Overview
Handle Server Errors
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/telleroo/response/raise_server_error.rb', line 8 def on_complete(env) status = env[:status].to_i headers = env[:response_headers] case status when 500 raise Telleroo::Error::ApplicationError.new "500 Something went wrong on our end. Please try again later.", headers when 503 raise Telleroo::Error::ServiceUnavailable.new "503 No server is available to handle this request.", headers end end |