Exception: Almodovar::UnprocessableEntityError
- Defined in:
- lib/almodovar/errors.rb
Instance Attribute Summary
Attributes inherited from HttpError
#response_body, #response_headers, #response_status, #response_url
Instance Method Summary collapse
-
#error_messages ⇒ Object
There are some different kind of errors in Almodovar servers “errors” => [=> “wadus”] “errors” => => [“wadus”, “foo”] “error” => {“message” => “chaflan”.
- #errors? ⇒ Boolean
Methods inherited from HttpError
Constructor Details
This class inherits a constructor from Almodovar::HttpError
Instance Method Details
#error_messages ⇒ Object
There are some different kind of errors in Almodovar servers “errors” => [=> “wadus”] “errors” => => [“wadus”, “foo”] “error” => {“message” => “chaflan”
In case we cannot parse the response an empty array is returned
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/almodovar/errors.rb', line 40 def @error_messages ||= begin if hash.key?('errors') Array.wrap(hash['errors']).flat_map do |error| error.is_a?(Hash) && error.key?('error') ? error['error'] : error.to_s end elsif hash.key?('error') Array.wrap(hash['error'] && hash['error']['message']) else [] end end end |
#errors? ⇒ Boolean
30 31 32 |
# File 'lib/almodovar/errors.rb', line 30 def errors? .any? end |