Class: Mailstro::Middleware::Response::RaiseError
- Inherits:
-
Faraday::Response::RaiseError
- Object
- Faraday::Response::RaiseError
- Mailstro::Middleware::Response::RaiseError
- Defined in:
- lib/mailstro/middleware/response/raise_error.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/mailstro/middleware/response/raise_error.rb', line 5 def on_complete(env) case env[:status] when 401 raise Error::AuthorisationError.new("api_key not authorised", env) when 422 raise Error::ValidationError.new(env[:body][:errors]) else super end end |