Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
future: don't forget to warn about ignored exception
When a future is destroyed without handling its exception, we print a warning message because this is bad programming practice and might hide an important exception. However, there is one similar case we don't warn about: Imagine that a fiber is deliberately started in parallel, by ignoring a returned future, e.g., future<> f(); something.then(){ [] { // Note we do not "return f()" here, we want it to run in parallel f(); }); Now, if the future returned by f is exceptional, it is ignored, but we do NOT warn about this. This is because the "future" object is destroyed immediately (before it becomes exceptional), and what remains is not a "future" but a "promise", and when that promise is destroyed while is still exceptional, no warning is printed. So this patch adds the same warning message we add during future destruction also to the promise destruction. Signed-off-by: Nadav Har'El <[email protected]>
- Loading branch information