Exception: AutomationObject::BluePrint::HashAdapter::ValidationError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/automation_object/blue_print/hash_adapter/helpers/validation_error.rb

Overview

ValidatorError exception class Allows for multiple errors at one time to allow for better debugging

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ ValidationError

Returns a new instance of ValidationError

Parameters:

  • errors (Array, String)

    pass validation error(s) in, class can handle singular or multiple



12
13
14
# File 'lib/automation_object/blue_print/hash_adapter/helpers/validation_error.rb', line 12

def initialize(errors)
  @errors = errors.is_a?(Array) ? errors : [errors]
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors



9
10
11
# File 'lib/automation_object/blue_print/hash_adapter/helpers/validation_error.rb', line 9

def errors
  @errors
end

Instance Method Details

#messageString

Returns full error message

Returns:

  • (String)

    returns full error message



17
18
19
20
21
22
23
24
# File 'lib/automation_object/blue_print/hash_adapter/helpers/validation_error.rb', line 17

def message
  message = "\nBluePrint::HashAdapter composite validation failed for the following errors:\n"
  @errors.each do |error|
    message += "     - #{error}\n"
  end

  message + "\n"
end