From b2668e61a5271da3b53053f93ada079671592958 Mon Sep 17 00:00:00 2001 From: Alex Christoffer Rasmussen Date: Sat, 11 May 2024 14:23:07 +0200 Subject: [PATCH] refactor: improve logging from http integration (#946) --- .../integration-service/HttpIntegration.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/server/src/services/integration-service/HttpIntegration.ts b/apps/server/src/services/integration-service/HttpIntegration.ts index 4809204e0..5b7c83a31 100644 --- a/apps/server/src/services/integration-service/HttpIntegration.ts +++ b/apps/server/src/services/integration-service/HttpIntegration.ts @@ -51,7 +51,24 @@ export class HttpIntegration implements IIntegration { - logger.error(LogOrigin.Tx, `HTTP Integration: ${err.code}`); + logger.warning(LogOrigin.Tx, `HTTP Integration: ${err.message}`); + + if (err.code === 'ECONNREFUSED') { + logger.warning(LogOrigin.Tx, `HTTP Integration: '${err.code}' The server refused the connection`); + return; + } + + if (err.code === 'ENOTFOUND') { + logger.warning(LogOrigin.Tx, `HTTP Integration: '${err.code}' DNS lookup failed`); + return; + } + + if (err.code === 'ETIMEDOUT') { + logger.warning(LogOrigin.Tx, `HTTP Integration: '${err.code}' The connection timed out`); + return; + } + + logger.warning(LogOrigin.Tx, `HTTP Integration: ${err.code}`); }); }