11 lines
331 B
JavaScript
11 lines
331 B
JavaScript
export const handleExitError = (err, type = 'Unhandled error') => {
|
|
const isExit = err?.name === 'ExitPromptError' || err?.code === 'ERR_CANCELED' || err?.message?.includes('SIGINT');
|
|
|
|
if (isExit) {
|
|
console.log('\n👋 Exiting. Cya!\n');
|
|
process.exit(0);
|
|
}
|
|
|
|
console.error(`❌ ${type}:`, err);
|
|
process.exit(1);
|
|
}
|