Exception: Eluvia::Errors::UnprocessableEntity
- Inherits:
-
StandardError
- Object
- StandardError
- StandardError
- Eluvia::Errors::UnprocessableEntity
- Defined in:
- lib/eluvia/errors/unprocessable_entity.rb
Instance Attribute Summary collapse
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
Attributes inherited from StandardError
#error, #message, #no_sentry, #source, #status, #timestamp
Instance Method Summary collapse
-
#initialize(messages = {}) ⇒ UnprocessableEntity
constructor
A new instance of UnprocessableEntity.
- #to_h ⇒ Object
Methods inherited from StandardError
Constructor Details
#initialize(messages = {}) ⇒ UnprocessableEntity
Returns a new instance of UnprocessableEntity.
7 8 9 10 |
# File 'lib/eluvia/errors/unprocessable_entity.rb', line 7 def initialize( = {}) super(nil, "Unprocessable Entity", 422, nil, false) @messages = end |
Instance Attribute Details
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
5 6 7 |
# File 'lib/eluvia/errors/unprocessable_entity.rb', line 5 def @messages end |
Instance Method Details
#to_h ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/eluvia/errors/unprocessable_entity.rb', line 12 def to_h .reduce([]) do |r, (attribute, )| r << { message: (.is_a?(Array) ? .join(', ') : ).humanize, error: error, status: status, source: attribute, timestamp: } end end |