Exception: CSVPlusPlus::Error::ModifierValidationError
- Inherits:
-
ModifierSyntaxError
- Object
- StandardError
- Error
- ModifierSyntaxError
- CSVPlusPlus::Error::ModifierValidationError
- Extended by:
- T::Sig
- Includes:
- PositionalError
- Defined in:
- lib/csv_plus_plus/error/modifier_validation_error.rb
Overview
An error that can be thrown when a modifier doesn’t pass our validation.
Instance Attribute Summary collapse
-
#bad_input ⇒ String
readonly
The offending input that caused the error to be thrown.
-
#choices ⇒ Array<Symbol>?
readonly
The choices that
value
must be one of (but violated). -
#message ⇒ String?
readonly
A relevant message to show.
-
#modifier ⇒ Symbol
readonly
The modifier being parsed when the bad input was encountered.
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(modifier, bad_input:, choices: nil, message: nil) ⇒ ModifierValidationError
constructor
You must supply either a
choices
ormessage
.
Methods inherited from ModifierSyntaxError
Methods inherited from Error
Constructor Details
#initialize(modifier, bad_input:, choices: nil, message: nil) ⇒ ModifierValidationError
You must supply either a choices
or message
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/csv_plus_plus/error/modifier_validation_error.rb', line 30 def initialize(modifier, bad_input:, choices: nil, message: nil) = ::T.let( if choices "must be one of (#{choices.values.map(&:serialize).join(', ')})" else ::T.must() end, ::String ) super(, bad_input:, modifier:) end |
Instance Attribute Details
#bad_input ⇒ String (readonly)
The offending input that caused the error to be thrown
12 13 14 |
# File 'lib/csv_plus_plus/error/modifier_validation_error.rb', line 12 def bad_input @bad_input end |
#choices ⇒ Array<Symbol>? (readonly)
The choices that value
must be one of (but violated)
12 13 14 |
# File 'lib/csv_plus_plus/error/modifier_validation_error.rb', line 12 def choices @choices end |
#message ⇒ String? (readonly)
A relevant message to show
12 13 14 |
# File 'lib/csv_plus_plus/error/modifier_validation_error.rb', line 12 def @message end |
#modifier ⇒ Symbol (readonly)
The modifier being parsed when the bad input was encountered
12 13 14 |
# File 'lib/csv_plus_plus/error/modifier_validation_error.rb', line 12 def modifier @modifier end |