Exception: Dentaku::ArgumentError
- Inherits:
-
ArgumentError
- Object
- ArgumentError
- Dentaku::ArgumentError
- Defined in:
- lib/dentaku/exceptions.rb
Constant Summary collapse
- VALID_REASONS =
%i[ invalid_operator invalid_value too_few_arguments too_much_arguments incompatible_type ].freeze
Instance Attribute Summary collapse
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(reason, **meta) ⇒ ArgumentError
constructor
A new instance of ArgumentError.
Constructor Details
#initialize(reason, **meta) ⇒ ArgumentError
Returns a new instance of ArgumentError.
78 79 80 81 |
# File 'lib/dentaku/exceptions.rb', line 78 def initialize(reason, **) @reason = reason @meta = end |
Instance Attribute Details
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
76 77 78 |
# File 'lib/dentaku/exceptions.rb', line 76 def @meta end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
76 77 78 |
# File 'lib/dentaku/exceptions.rb', line 76 def reason @reason end |
Class Method Details
.for(reason, **meta) ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/dentaku/exceptions.rb', line 90 def self.for(reason, **) unless VALID_REASONS.include?(reason) raise ::ArgumentError, "Unhandled #{reason}" end new(reason, **) end |