Exception: Eddy::Errors::ElementValidationError

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

Overview

Exception raised by descendents of Eddy::Element::Base.

Element Validation Errors collapse

Element Validation Errors collapse

Constructor Details

#initialize(msg = "", element: nil) ⇒ void



19
20
21
22
23
# File 'lib/eddy/errors.rb', line 19

def initialize(msg = "", element: nil)
  self.element = element unless element.nil?
  msg = "Invalid value assigned to element #{element_description()}. " << msg
  super(msg)
end

Instance Attribute Details

#argObject

Argument that caused the exception when passed to value=. (if applicable)



14
15
16
# File 'lib/eddy/errors.rb', line 14

def arg
  @arg
end

#elementEddy::Element::Base



11
12
13
# File 'lib/eddy/errors.rb', line 11

def element
  @element
end

Instance Method Details

#element_descriptionString



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/eddy/errors.rb', line 26

def element_description()
  el = self.element
  return "" if el.nil?
  description = ""
  if !el.ref.nil? && el.ref.length > 0
    description << el.ref
  else
    description << el.class.name.split("::").last
  end
  description << " (#{el.name})"
  return description
end