Class: AWSCloudSearch::HttpCodeResponseMiddleware
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- AWSCloudSearch::HttpCodeResponseMiddleware
- Defined in:
- lib/aws_cloud_search.rb
Instance Method Summary collapse
-
#initialize(app) ⇒ HttpCodeResponseMiddleware
constructor
A new instance of HttpCodeResponseMiddleware.
- #on_complete(env) ⇒ Object
Constructor Details
#initialize(app) ⇒ HttpCodeResponseMiddleware
Returns a new instance of HttpCodeResponseMiddleware.
72 73 74 75 |
# File 'lib/aws_cloud_search.rb', line 72 def initialize(app) super @parser = nil end |
Instance Method Details
#on_complete(env) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/aws_cloud_search.rb', line 55 def on_complete(env) case env[:status] when 200..299 nil when 408 raise RequestTimeout, env[:body] when 400..499 raise HttpClientError, env[:body] when 509 raise BandwidthLimitExceeded, env[:body] when 500..599 raise HttpServerError, env[:body] else raise UnexpectedHTTPException, env[:body] end end |