Skip to content

Commit

Permalink
prevent misleading "must specify Promise, got Promise"
Browse files Browse the repository at this point in the history
by adding defined/undefined when the thing passed is a type object.
  • Loading branch information
timo committed Sep 2, 2016
1 parent 6dab6b8 commit b48c62f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/asyncops.pm
Expand Up @@ -7,7 +7,10 @@ proto sub await(|) { * }
multi sub await() {
die "Must specify a Promise or Channel to await on (got an empty list)";
}
multi sub await(Any $x) {
multi sub await(Any:U $x) {
die "Must specify a defined Promise or Channel to await on (got an undefined $x.^name())";
}
multi sub await(Any:D $x) {
die "Must specify a Promise or Channel to await on (got a $x.^name())";
}
multi sub await(Iterable:D $i) { $i.eager.map({ await $_ }) }
Expand Down

0 comments on commit b48c62f

Please sign in to comment.