Exception: JsonMessage::ValidationError

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

Overview

One or more field’s values didn’t match their schema

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ ValidationError

Returns a new instance of ValidationError.



24
25
26
# File 'lib/json_message.rb', line 24

def initialize(errors)
  @errors = errors
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



22
23
24
# File 'lib/json_message.rb', line 22

def errors
  @errors
end

Instance Method Details

#to_sObject



28
29
30
31
# File 'lib/json_message.rb', line 28

def to_s
  err_strs = @errors.map { |f, e| "Field: #{f}, Error: #{e}" }
  err_strs.join(', ')
end