mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
Fixes #23865, Fixes ENG-21446 Previously, a termination exception would be thrown. We didn't handle it properly and eventually it got caught by a `catch @panic()` handler. Now, no termination exception is thrown. ``` drainMicrotasksWithGlobal calls JSC__JSGlobalObject__drainMicrotasks JSC__JSGlobalObject__drainMicrotasks returns m_terminationException -> drainMicrotasksWithGlobal -> event_loop.zig:exit, which catches the error and discards it -> ... ``` For workers, we will need to handle termination exceptions in this codepath. ~~Previously, it would see the exception, call reportUncaughtExceptoinAtEventLoop, but the exception would still survive and return out from the catch scope. You're not supposed to still have an exception signaled at the exit of a catch scope. Exception checker may not have caught it because maybe the branch wasn't taken.~~ --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
8 lines
152 B
TypeScript
8 lines
152 B
TypeScript
// Should not crash
|
|
test("abc", () => {
|
|
expect(async () => {
|
|
await Bun.sleep(100);
|
|
throw new Error("uh oh!");
|
|
}).toThrow("uh oh!");
|
|
}, 50);
|