Class: FamilySearch::Middleware::RaiseErrors
- Inherits:
-
Faraday::Response::RaiseError
- Object
- Faraday::Response::RaiseError
- FamilySearch::Middleware::RaiseErrors
- Defined in:
- lib/familysearch/middleware/response/familysearch_errors.rb
Overview
Handles the raising of errors within the Faraday call stack.
Instance Method Summary collapse
-
#on_complete(env) ⇒ Object
If a 400-600 error is raised by the HTTP call, raise it within the app.
Instance Method Details
#on_complete(env) ⇒ Object
If a 400-600 error is raised by the HTTP call, raise it within the app.
9 10 11 12 13 14 15 16 17 |
# File 'lib/familysearch/middleware/response/familysearch_errors.rb', line 9 def on_complete(env) case env[:status] when 401 # response_values is a method of the RaiseError class raise FamilySearch::Error::BadCredentials, response_values(env) when 400...600 raise FamilySearch::Error::ClientError, response_values(env) end end |