GorNishanov / coroutines-ts

20 stars 2 forks source link

why no detail exception ABI specified in N4649? #12

Closed JCYang closed 7 years ago

JCYang commented 7 years ago

promise.unhandled_exception() is only shown in pseudo code, but no further detail description in 8.4.4. And in the previous introduction blogs and videos(e.g the one by James McNellis), there can be a set_exception() in promise_type, but also not mentioned in the TS, why? There semantic are not very clear, especially the promise_type::unhandled_exception(), what's the point without clear exception ABI/API specification?

GorNishanov commented 7 years ago

set_exception was renamed to unhandled_exception in November of 2016. VS 2017.3 supports both modes to ease the transition.

If you used to write:

void set_exception(exception_ptr e} { foo(e); }

Now you need to write:

void unhandled_exception() { foo(std::current_exception()); }

Also, it is no longer an optional member of coroutine promise. You must provide unhandled_exception in your coroutine promise.