From 11e0a40e1c81a6fbf5978c3ce8118f0632fc3379 Mon Sep 17 00:00:00 2001 From: Determinant Date: Sat, 27 Jan 2018 22:31:28 -0500 Subject: pass on the resolution/rejection when not pending --- promise.hpp | 4 ++-- 1 file 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)); -- cgit v1.2.3-70-g09d2