Exception: Dentaku::ArgumentError
- Inherits:
-
ArgumentError
- Object
- ArgumentError
- Dentaku::ArgumentError
- Includes:
- Error
- Defined in:
- lib/dentaku/exceptions.rb
Constant Summary collapse
- VALID_REASONS =
%i[ incompatible_type invalid_operator invalid_value too_few_arguments wrong_number_of_arguments ].freeze
Instance Attribute Summary collapse
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
Attributes included from Error
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.
148 149 150 151 152 |
# File 'lib/dentaku/exceptions.rb', line 148 def initialize(reason, **) @reason = reason @meta = super() end |
Instance Attribute Details
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
146 147 148 |
# File 'lib/dentaku/exceptions.rb', line 146 def @meta end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
146 147 148 |
# File 'lib/dentaku/exceptions.rb', line 146 def reason @reason end |
Class Method Details
.for(reason, **meta) ⇒ Object
164 165 166 167 168 169 170 |
# File 'lib/dentaku/exceptions.rb', line 164 def self.for(reason, **) unless VALID_REASONS.include?(reason) raise ::ArgumentError, "Unhandled #{reason}" end new(reason, **) end |