Exception: Dry::Guards::NotGuardable
- Inherits:
-
StandardError
- Object
- StandardError
- Dry::Guards::NotGuardable
- Defined in:
- lib/dry/errors/not_guardable.rb
Instance Method Summary collapse
-
#initialize(method, cause) ⇒ NotGuardable
constructor
A new instance of NotGuardable.
Constructor Details
#initialize(method, cause) ⇒ NotGuardable
Returns a new instance of NotGuardable.
4 5 6 7 8 9 10 11 12 |
# File 'lib/dry/errors/not_guardable.rb', line 4 def initialize(method, cause) reason = case cause when :nil then 'source location is inavailable' when Errno::ENOENT then "source file could not be read [#{cause.}]" when :when_is_nil then 'when clause is missing' when :when_not_hash then 'when clause is not a hash' end super "Can’t guard method “#{method.inspect}” (#{reason}.)" end |