Class: IndexTank::DocumentResponseMiddleware
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- IndexTank::DocumentResponseMiddleware
- Defined in:
- lib/indextank/document.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/indextank/document.rb', line 68 def on_complete(env) case env[:status] when 200 nil # this is the expected code when 204 nil # this is another expected code, for empty responses when 401 raise InvalidApiKey when 409 raise IndexInitializing when 404 raise NonExistentIndex when 400 raise InvalidArgument, env[:body] else raise UnexpectedHTTPException, env[:body] end end |