#563·quickjs

在 PromiseResolve 发生异常时, await 会绕过捕获

作者: xeioex创建于 2026年9月25日更新于 2026年9月25日

使用独立的 qjs CLI 重现(在 d73189d 中重现,没有嵌入代码):

bash
./qjs -e 'const p = Promise.resolve(1);
Object.defineProperty(p, "constructor", { get() { throw Error("boom"); } });
(async () => {
    try { await p; } catch (e) { print("caught: " + e.message); }
})();'

内容来源: bellard/quickjs