aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2018-01-27 22:31:28 -0500
committerDeterminant <[email protected]>2018-01-27 22:31:28 -0500
commit11e0a40e1c81a6fbf5978c3ce8118f0632fc3379 (patch)
tree12a940f1d2c5e4b6669d6c36eb87d2e610b967ad
parenta979e6d6d182850925c8dd65bd5f34c72063d895 (diff)
pass on the resolution/rejection when not pending
-rw-r--r--promise.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/promise.hpp b/promise.hpp
index e197803..58b644f 100644
--- a/promise.hpp
+++ b/promise.hpp
@@ -177,7 +177,7 @@ namespace promise {
gen_on_fulfilled(on_fulfilled, npm)();
});
case State::Rejected:
- return promise_t([](promise_t npm) {});
+ return promise_t([this](promise_t npm) {npm.reject(reason);});
default: PROMISE_ERR_INVALID_STATE;
}
}
@@ -192,7 +192,7 @@ namespace promise {
add_on_fulfilled([this, npm]() {npm.resolve(result);});
});
case State::Fulfilled:
- return promise_t([](promise_t npm) {});
+ return promise_t([this](promise_t npm) {npm.resolve(result);});
case State::Rejected:
return promise_t([this, on_rejected](promise_t npm) {
add_on_rejected(gen_on_rejected(on_rejected, npm));