Exception: Rootage::NormalizerValueError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rootage/exception.rb

Overview

NormalizerValueError is raised when the value cannot convert into the normalization type.

Instance Method Summary collapse

Constructor Details

#initialize(type, value, detail) ⇒ NormalizerValueError

Returns a new instance of NormalizerValueError.



71
72
73
74
75
# File 'lib/rootage/exception.rb', line 71

def initialize(type, value, detail)
  @type = type
  @value = value
  @detail = detail
end

Instance Method Details

#messageObject



77
78
79
80
81
82
83
84
85
86
# File 'lib/rootage/exception.rb', line 77

def message
  case @type
  when Symbol
    '"%s" cannot normalize as "%s": %s' % [@value, @type, @detail]
  when Array
    '"%s" should be in the range of "%s".' % [@value, @type]
  else
    raise NormalizerTypeError.new(@type)
  end
end