mirror of
https://github.com/oven-sh/bun
synced 2026-02-13 20:39:05 +00:00
Previously, `handleRejectedPromises()` would panic when encountering
a termination exception (e.g., when a worker is terminated). This caused
unreachable panics during worker termination because the termination
exception could not be cleared by the C++ code's internal exception handling.
This change:
- Changes `handleRejectedPromises` to return `bun.JSTerminated!void`
- Uses `assertNoExceptionExceptTermination` to properly detect termination
- Updates all callers to handle the error appropriately:
- Most callers use `catch {}` to silently ignore (appropriate for cleanup)
- Event loop tick uses `catch return` to exit the tick early
- Test runner uses `catch break` to exit loops
Fixes the panic reported in https://bun.report/1.3.6/Ma1d530ed9gDqgggC2zr+3CukulGmskkGmogsF+wzwiBm752Eu519E2mhB+oX__A0eNorzStKTUzOSEzKSQUAG3AEew/view
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>