Skip to content

Commit

Permalink
Renamed exception to X::Promise::Resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
dumarchie committed Sep 4, 2019
1 parent 5aa998f commit f32b86a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core.c/Promise.pm6
Expand Up @@ -15,10 +15,10 @@ my class X::Promise::Vowed is Exception {
has $.promise;
method message() { "Access denied to keep/break this Promise; already vowed" }
}
my class X::Promise::IllegalTransition is Exception {
my class X::Promise::Resolved is Exception {
has $.promise;
method message() {
"Illegal attempt to keep/break this Promise (status: $!promise.status())";
"Cannot keep/break a Promise more than once (status: $!promise.status())";
}
}
my role X::Promise::Broken {
Expand Down Expand Up @@ -102,7 +102,7 @@ my class Promise does Awaitable {

method !keep(Mu \result --> Nil) {
$!lock.protect({
X::Promise::IllegalTransition.new(promise => self).throw
X::Promise::Resolved.new(promise => self).throw
if $!status != Planned;

$!result := result;
Expand Down Expand Up @@ -134,7 +134,7 @@ my class Promise does Awaitable {

method !break(\result --> Nil) {
$!lock.protect({
X::Promise::IllegalTransition.new(promise => self).throw
X::Promise::Resolved.new(promise => self).throw
if $!status != Planned;

$!result := nqp::istype(result, Exception)
Expand Down

0 comments on commit f32b86a

Please sign in to comment.