Skip Menu |
Report information
Id: 132835
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: david [at] empireofgames.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



To: rakudobug [...] perl.org
Subject: "An operation first awaited" error needs to be clearer
From: "David E." <david [...] empireofgames.com>
Date: Thu, 8 Feb 2018 17:34:08 -0500
Download (untitled) / with headers
text/plain 1.2k
I've wasted more time than I should've the past few days trying to understand what this message means.  At a minimum the documentation should be updated, but preferably the error message itself should be clarified.

The example on https://docs.perl6.org/language/traps is not entirely clear, and did not at all match the scenario I was hitting.  The provided stack trace also fails to point to the source of the issue.

A trivialized example:
Show quoted text
say "Test await after fulfillment";
my $p = Promise.new();
my $vow = $p.vow;
$vow.break(1);
await $p;

Results in:
Show quoted text
An operation first awaited:
  in block <unit> at ../test.pl6 line 5

Died with the exception:
    1
      in block <unit> at ../test.pl6 line 5


This haiku-like message simply means that the Promise/Vow has been broken.  Farther, the exception points to the "await $p" line, when it's really the "$vow.break" line that's responsible for the trouble.

I'd suggest a better error message in this case (if possible) would be something like:
Show quoted text
A Promise was broken by ../test.pl6 line 4 awaited upon
  in block <unit> at ../test.pl6 line 5

Died with the exception:
    1
      in block <unit> at ../test.pl6 line 5



Just trying to do my part to make Perl6 better ;-)
- David


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org