is Exception
Error, typically wrapped in a Failure
, when inappropriately using an empty collection.
For example, the following stack implementation fails when trying to pop a value from an empty stack. Sink context causes the returned Failure
to throw.
my = Stack.new.push(42);say .pop; # OUTPUT: «42»try .pop;say $!.message; # OUTPUT: «Cannot pop from an empty Stack»
Methods§
method action§
method action()
Verbal description of the inappropriate action.
method what§
method what()
Returns the type that was the target of the action.