Exception: Eddy::Errors::ElementValidationError
- Defined in:
- lib/eddy/errors.rb
Overview
Exception raised by descendents of Models::Element::Base.
Direct Known Subclasses
ElementNilValueError, LengthValidationError, TypeValidationError
Element Validation Errors collapse
-
#arg ⇒ Object
Argument that caused the exception when passed to
value=
. -
#element ⇒ Eddy::Models::Element::Base
Element instance that raised the exception.
Element Validation Errors collapse
Constructor Details
#initialize(msg = "", element: nil) ⇒ void
32 33 34 35 36 |
# File 'lib/eddy/errors.rb', line 32 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
#arg ⇒ Object
Argument that caused the exception when passed to value=
. (if applicable)
27 28 29 |
# File 'lib/eddy/errors.rb', line 27 def arg @arg end |
#element ⇒ Eddy::Models::Element::Base
Returns Element instance that raised the exception.
24 25 26 |
# File 'lib/eddy/errors.rb', line 24 def element @element end |
Instance Method Details
#element_description ⇒ String
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/eddy/errors.rb', line 39 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 |