Skip to content

Commit 5f1af37

Browse files
committed
refactor: remove duplicate error log
1 parent ba2f3a3 commit 5f1af37

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

packages/prompts/src/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -642,16 +642,15 @@ export const spinner = () => {
642642
unblock();
643643
};
644644

645-
const handleExit = (code: number, error?: unknown) => {
645+
const handleExit = (code: number) => {
646646
const message = code > 1 ? 'Something went wrong' : 'Canceled';
647647
if (isSpinnerActive) stop(message, code);
648-
if (error) console.error(error);
649648
};
650649

651650
// Reference: https://nodejs.org/api/process.html#event-uncaughtexception
652-
process.on('uncaughtException', (error) => handleExit(2, error));
651+
process.on('uncaughtExceptionMonitor', () => handleExit(2));
653652
// Reference: https://nodejs.org/api/process.html#event-unhandledrejection
654-
process.on('unhandledRejection', (error) => handleExit(2, error));
653+
process.on('unhandledRejection', () => handleExit(2));
655654
// Reference Signal Events: https://nodejs.org/api/process.html#signal-events
656655
process.on('SIGINT', () => handleExit(1));
657656
process.on('SIGTERM', () => handleExit(1));

0 commit comments

Comments
 (0)