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
20 21 22 23 24 |
# File 'lib/eddy/errors.rb', line 20 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)
15 16 17 |
# File 'lib/eddy/errors.rb', line 15 def arg @arg end |
#element ⇒ Eddy::Models::Element::Base
Returns Element instance that raised the exception.
12 13 14 |
# File 'lib/eddy/errors.rb', line 12 def element @element end |
Instance Method Details
#element_description ⇒ String
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/eddy/errors.rb', line 27 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 |