Exception: Anypost::ValidationError

Inherits:
Error
  • Object
show all
Defined in:
lib/anypost/errors.rb

Overview

400/422 — the request body or query failed validation.

Instance Attribute Summary collapse

Attributes inherited from Error

#raw, #request_id, #status, #type

Instance Method Summary collapse

Constructor Details

#initialize(message, errors: {}, **kwargs) ⇒ ValidationError

Returns a new instance of ValidationError.



34
35
36
37
# File 'lib/anypost/errors.rb', line 34

def initialize(message, errors: {}, **kwargs)
  super(message, **kwargs)
  @errors = errors || {}
end

Instance Attribute Details

#errorsHash{String => Array<String>} (readonly)

Returns field path -> list of problems.

Returns:

  • (Hash{String => Array<String>})

    field path -> list of problems



32
33
34
# File 'lib/anypost/errors.rb', line 32

def errors
  @errors
end