19 lines
674 B
TypeScript
19 lines
674 B
TypeScript
// Helper function to handle daemon connection errors
|
|
export function handleDaemonError(error: any, action: string): void {
|
|
if (
|
|
error.message?.includes('daemon is not running') ||
|
|
error.message?.includes('Not connected') ||
|
|
error.message?.includes('ECONNREFUSED')
|
|
) {
|
|
console.error(`Error: Cannot ${action} - TSPM daemon is not running.`);
|
|
console.log('\nTo start the daemon, run one of:');
|
|
console.log(' tspm daemon start - Start for this session only');
|
|
console.log(
|
|
' tspm enable - Enable as system service (recommended)',
|
|
);
|
|
} else {
|
|
console.error(`Error ${action}:`, error.message);
|
|
}
|
|
process.exit(1);
|
|
}
|