Exception: BaseCradle::ValidationError

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

Overview

A submitted record failed validation (HTTP 422). errors maps attribute name to a list of messages (empty when the API sent none).

Instance Attribute Summary collapse

Attributes inherited from Error

#code, #detail, #instance, #problem, #status, #title

Instance Method Summary collapse

Methods inherited from Error

from_response

Constructor Details

#initialize(message = nil, errors: nil, **kwargs) ⇒ ValidationError

Returns a new instance of ValidationError.



93
94
95
96
# File 'lib/basecradle/errors.rb', line 93

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

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



91
92
93
# File 'lib/basecradle/errors.rb', line 91

def errors
  @errors
end