class Eddy::Errors::LengthValidationError

Exception raised when an invalid argument is passed to the `value=` method of an {Eddy::Models::Element::Base} class.

Public Class Methods

new(msg = "", element:, arg:) click to toggle source

@param element [Eddy::Models::Element::Base] Element instance that raised the exception. @param arg [Object] Passed argument that caused the exception. @param msg [String] (“”) @return [void]

# File lib/eddy/errors.rb, line 103
def initialize(msg = "", element:, arg:)
  self.element = element
  self.arg = arg
  if msg.length == 0
    msg << "Value can't be longer than #{self.element.max}. "
    msg << "Length of recieved value: #{self.arg.to_s.length}"
  end
  super(msg)
end