83b0f9551b
- Introduced `/api/admin/restart` and `/api/admin/shutdown` endpoints in WorkerService for restarting and shutting down the service. - Updated error message in hook-error-handler to provide clearer instructions for restarting the worker. - Refactored worker-utils to remove PM2 dependency and implement ProcessManager for starting the worker service. - Cleaned up legacy PM2 references and provided new manual start instructions.
15 lines
492 B
TypeScript
15 lines
492 B
TypeScript
/**
|
|
* Handles fetch errors by providing user-friendly messages for connection issues
|
|
* @throws Error with helpful message if worker is unreachable, re-throws original otherwise
|
|
*/
|
|
export function handleWorkerError(error: any): never {
|
|
if (error.cause?.code === 'ECONNREFUSED' ||
|
|
error.name === 'TimeoutError' ||
|
|
error.message?.includes('fetch failed')) {
|
|
throw new Error(
|
|
"There's a problem with the worker. Try: npm run worker:restart"
|
|
);
|
|
}
|
|
throw error;
|
|
}
|