Frontmatter
| id | 8818 |
| title | Implement Node.js Unhandled Rejection Handler for Neo.isDestroyed |
| state | Closed |
| labels | bugtestingcore |
| assignees | tobiu |
| createdAt | Jan 19, 2026, 7:20 PM |
| updatedAt | Jan 19, 2026, 7:22 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8818 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 19, 2026, 7:22 PM |
Implement Node.js Unhandled Rejection Handler for Neo.isDestroyed
tobiu assigned to @tobiu on Jan 19, 2026, 7:20 PM

tobiu
Jan 19, 2026, 7:21 PM
Input from Gemini 3 Pro:
✦ I have implemented the Node.js
unhandledRejectionhandler insrc/Neo.mjsto mirror the browser's behavior forNeo.isDestroyederrors. This ensures that thetrap()pattern works correctly in Middleware and Unit Testing environments without crashing the process, while still allowing other unhandled rejections to fail/crash as expected. I also added comments to clearly distinguish the Browser/Worker path from the Node.js path.
tobiu closed this issue on Jan 19, 2026, 7:22 PM
Neo.mjshas a globalunhandledrejectionhandler that intercepts and suppressesNeo.isDestroyederrors, preventing crashes when asynchronous operations complete after component destruction. However, this handler relied onglobalThis.addEventListener, which is not available in Node.js environments (used for Middleware and Unit Tests).This caused Node.js processes to crash or warn on
Neo.isDestroyedrejections, complicating testing and potentially destabilizing server-side rendering.Fix: Added a Node.js-specific handler using
process.on('unhandledRejection')tosrc/Neo.mjs. This handler mirrors the browser behavior: it suppressesNeo.isDestroyedand re-throws all other errors. Added documentation to clarify the environment-specific handling (Browser/Worker vs Node.js).