Skip to content

Commit

Permalink
Make Channel.elems return a Failure
Browse files Browse the repository at this point in the history
Rather than silently eating the currently available values on the
Channel and then returning the number of values eaten.

Inspired by discussion started at

  http://irclog.perlgeek.de/perl6/2016-09-14#i_13206149
  • Loading branch information
lizmat committed Sep 14, 2016
1 parent beec02a commit 5f2e96b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/Channel.pm
Expand Up @@ -167,6 +167,10 @@ my class Channel {
Nil
}

method elems() {
Failure.new("Cannot determine number of elements on a {self.^name}")
}

method fail($error is copy) {
$!closed = 1;
$error = X::AdHoc.new(payload => $error) unless nqp::istype($error, Exception);
Expand Down

0 comments on commit 5f2e96b

Please sign in to comment.