T M
class X::Channel::ReceiveOnClosed
Error ReportCollection examples

Error due to calling receive on a closed channel

class X::Channel::ReceiveOnClosed {}

This exception is thrown when a calling receive on a Channel that has been closed:

my $s = Channel.new;
$s.close;
$s.receive;     # Cannot receive a message on a closed channel 
CATCH { default { put .^name''.Str } };
# OUTPUT: «X::Channel::ReceiveOnClosed: Cannot receive a message on a closed channel␤»

Methods

method channel

method Channel(X::Channel::ReceiveOnClosed:D: --> Channel:D)

Returns the Channel object on which the receive method was called.