Class: Librato::Metrics::Middleware::ExpectsStatus
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- Librato::Metrics::Middleware::ExpectsStatus
- Defined in:
- lib/librato/metrics/middleware/expects_status.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/librato/metrics/middleware/expects_status.rb', line 7 def on_complete(env) # TODO: clean up exception output # TODO: catch specific status codes by request case env[:status] when 401 raise Unauthorized, env.to_s when 403 raise Forbidden, env.to_s when 404 raise NotFound, env.to_s when 422 raise EntityAlreadyExists, env.to_s when 400..499 raise ClientError, env.to_s when 500..599 raise ServerError, env.to_s end end |