update
This commit is contained in:
14
ts/cli/helpers/errors.ts
Normal file
14
ts/cli/helpers/errors.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// 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);
|
||||
}
|
Reference in New Issue
Block a user