MCPcopy Create free account
hub / github.com/anus-dev/ANUS / setupUnhandledRejectionHandler

Function setupUnhandledRejectionHandler

packages/cli/src/anus.tsx:116–136  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

114import { runZedIntegration } from './zed-integration/zedIntegration.js';
115
116export function setupUnhandledRejectionHandler() {
117 let unhandledRejectionOccurred = false;
118 process.on('unhandledRejection', (reason, _promise) => {
119 const errorMessage = `=========================================
120This is an unexpected error. Please file a bug report using the /bug tool.
121CRITICAL: Unhandled Promise Rejection!
122=========================================
123Reason: ${reason}${
124 reason instanceof Error && reason.stack
125 ? `
126Stack trace:
127${reason.stack}`
128 : ''
129 }`;
130 appEvents.emit(AppEvent.LogError, errorMessage);
131 if (!unhandledRejectionOccurred) {
132 unhandledRejectionOccurred = true;
133 appEvents.emit(AppEvent.OpenDebugConsole);
134 }
135 });
136}
137
138export async function main() {
139 setupUnhandledRejectionHandler();

Callers 2

anus.test.tsxFile · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected