class Eddy::Errors::ElementValidationError
Exception raised by descendents of {Eddy::Models::Element::Base}.
Attributes
arg[RW]
Argument that caused the exception when passed to `value=`. (if applicable) @return [Object]
element[RW]
@return [Eddy::Models::Element::Base] Element instance that raised the exception.
Public Class Methods
new(msg = "", element: nil)
click to toggle source
@param msg [String] (“”) @param element [Eddy::Models::Element::Base] (nil) Element instance that raised the exception. @return [void]
Calls superclass method
# 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
Public Instance Methods
element_description()
click to toggle source
@return [String]
# 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