From 95808b06b9f1c194350e12a696a5b107561f1b64 Mon Sep 17 00:00:00 2001 From: Guillim Date: Fri, 25 Apr 2025 18:01:53 +0200 Subject: [PATCH] Messaging-logging (#11723) parseBatchResponse: we need more logs to understand why we have some empty repsonse in the body. For anothe PR: ~~UNKNOWN_NETWORK_ERROR : moving from handleUnknownException to handleTemporaryException. This is important since in the logs I saw "The service is currently unavailable" which makes me think we should handle this type of error with as temporary~~ --- .../services/microsoft-get-messages.service.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-messages.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-messages.service.ts index 7998c211a..bd5910941 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-messages.service.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-get-messages.service.ts @@ -138,10 +138,21 @@ export class MicrosoftGetMessagesService { return response.body; } + if (!response.body) { + this.logger.error(`No body found for response`, response); + } + + const errorParsed = response?.body?.error + ? response.body.error + : { + message: + 'Microsoft parseBatchResponse error: no response.body.error', + }; + return { error: { - ...response.body.error, - statusCode: response.status, + ...errorParsed, + statusCode: response?.status, }, }; });