Commit 7b5d03d6 authored by James Sedgwick's avatar James Sedgwick Committed by woo

fix deprecated Promise::setException()

Summary: should have been using fulfilTry anyways. and fulfilTry needs to take the Try by value so fix that too

Test Plan: unit

Reviewed By: hans@fb.com

Subscribers: fugalh, folly-diffs@, jsedgwick

FB internal diff: D1808923

Tasks: 6098987

Signature: t1:1808923:1422478981:d4b9727394339c996ebccb7841b94e0c7b2bffb4
parent fcccccc2
......@@ -107,7 +107,7 @@ void Promise<T>::setInterruptHandler(
}
template <class T>
void Promise<T>::fulfilTry(Try<T>&& t) {
void Promise<T>::fulfilTry(Try<T> t) {
throwIfFulfilled();
core_->setResult(std::move(t));
}
......
......@@ -77,7 +77,7 @@ public:
template <class M>
void setValue(M&& value);
void fulfilTry(Try<T>&& t);
void fulfilTry(Try<T> t);
/** Fulfil this Promise with the result of a function that takes no
arguments and returns something implicitly convertible to T.
......
......@@ -56,16 +56,9 @@ class OutputBufferingHandler : public BytesToBytesHandler,
void runLoopCallback() noexcept override {
MoveWrapper<std::vector<Promise<void>>> promises(std::move(promises_));
ctx_->fireWrite(std::move(sends_)).then([promises](Try<void>&& t) mutable {
try {
t.throwIfFailed();
for (auto& p : *promises) {
p.setValue();
}
} catch (...) {
for (auto& p : *promises) {
p.setException(std::current_exception());
}
ctx_->fireWrite(std::move(sends_)).then([promises](Try<void> t) mutable {
for (auto& p : *promises) {
p.fulfilTry(t);
}
});
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment