You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Propagate errors through val coroutine hierarchy. (#23653)
Fix bug when failure or exception happening in a >1 level of the val
coroutine call hierarchy is not being propagated. As a result only deep
most level coroutine promise is rejected, other val promises including
top most one remain in a perpetual pending state.
The bug can be reproduced by the following example:
``` cpp
emscripten::val fetch(const std::string& url) {
co_return co_await emscripten::val::global("fetch")(url);
}
emscripten::val json(const std::string& url) {
auto response = co_await fetch(url);
co_return co_await response.call<emscripten::val>("json");
}
EMSCRIPTEN_BINDINGS(module) {
function("json", &json);
}
```
```js
let p = Module.json('invalid.url'); // JS error is printed, but p remains pending
try {
let p = await Module.json('invalid.url'); // JS error is printed
} catch(e) {
console.log('Caught coro error!'); // this line is never printed
}
```
0 commit comments