Exception: Plurimath::ConfigurationError

Inherits:
Error
  • Object
show all
Defined in:
lib/plurimath/errors/configuration_error.rb

Instance Method Summary collapse

Constructor Details

#initialize(type, value: nil, supported: nil, option: nil) ⇒ ConfigurationError

Returns a new instance of ConfigurationError.



5
6
7
8
9
10
11
# File 'lib/plurimath/errors/configuration_error.rb', line 5

def initialize(type, value: nil, supported: nil, option: nil)
  @type = type
  @value = value
  @supported = supported
  @option = option
  super(message)
end

Instance Method Details

#messageObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/plurimath/errors/configuration_error.rb', line 13

def message
  case @type
  when :unsupported_deprecation_behavior
    "unsupported deprecation behavior: #{@value.inspect}; " \
    "expected one of #{@supported.inspect}"
  when :missing_deprecation_feature
    "deprecation feature must be provided"
  when :conflicting_formatter_options
    "formatter options cannot be used together: choose either " \
    ":padding_digits or :padding_group_digits"
  when :invalid_formatter_option
    "invalid value #{@value.inspect} for formatter option " \
    "#{@option.inspect}#{" (expected #{@supported})" if @supported}"
  else
    "invalid Plurimath configuration"
  end
end