Class: CloudflareClient::Middleware::Response::RaiseError
- Inherits:
-
Object
- Object
- CloudflareClient::Middleware::Response::RaiseError
- Defined in:
- lib/cloudflare_client/middleware/response/raise_error.rb
Overview
Raises ResponseError exceptions when a response status in either the 4xx range or the 5xx range is encountered. There are a number of specific exception mappings as well as general exception types covering the respective ranges.
Constant Summary collapse
- CLIENT_ERRORS =
400...500
- SERVER_ERRORS =
500...600
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ RaiseError
constructor
A new instance of RaiseError.
Constructor Details
#initialize(app) ⇒ RaiseError
Returns a new instance of RaiseError.
53 54 55 |
# File 'lib/cloudflare_client/middleware/response/raise_error.rb', line 53 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
57 58 59 60 61 |
# File 'lib/cloudflare_client/middleware/response/raise_error.rb', line 57 def call(env) response = @app.call(env) handle_status(response, env.method, env.url.request_uri, env.url.to_s) response end |