Exit only on ECONNREFUSED and ENOTFOUND

This commit is contained in:
Iván Ovejero 2024-11-07 18:17:24 +01:00
parent fd728ab06a
commit 1bd0a6e381
No known key found for this signature in database

View file

@ -90,15 +90,15 @@ export abstract class TaskRunner {
});
this.ws.addEventListener('error', (error) => {
if (error.message?.includes('ECONNREFUSED') || error.message?.includes('ETIMEDOUT')) {
if (error.message?.includes('ECONNREFUSED') || error.message?.includes('ENOTFOUND')) {
console.error(
`Error: Failed to connect to n8n. Please ensure n8n is reachable at: ${opts.n8nUri}`,
);
process.exit(1);
} else {
console.error(`Error: Failed to connect to n8n at ${opts.n8nUri}`);
console.error('Details:', error.message || 'Unknown error');
}
process.exit(1);
});
this.ws.addEventListener('message', this.receiveMessage);
this.ws.addEventListener('close', this.stopTaskOffers);