Performance: Handling uncaught exceptions
HIGH IMPACT
This affects the server's uptime and responsiveness by preventing crashes from unexpected errors.
process.on('uncaughtException', (err) => { console.error('Fatal error:', err); process.exit(1); // Exit to avoid unstable state });
process.on('uncaughtException', (err) => { console.log('Error:', err); // No process exit or recovery });
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Logging error without exit | N/A | N/A | N/A | [X] Bad |
| Logging error with process exit | N/A | N/A | N/A | [OK] Good |
| No cleanup on error | N/A | N/A | N/A | [X] Bad |
| Graceful shutdown before exit | N/A | N/A | N/A | [OK] Good |