From 3b9e7c38ebc7b91a489a5d4334bb17b9721590a9 Mon Sep 17 00:00:00 2001 From: Guillim Date: Thu, 27 Mar 2025 16:19:57 +0100 Subject: [PATCH] better error handling for messaging import in case of unknown error (#11228) --- .../services/messaging-import-exception-handler.service.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-import-exception-handler.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-import-exception-handler.service.ts index 0064748dc..f31e56b7d 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-import-exception-handler.service.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-import-exception-handler.service.ts @@ -1,5 +1,6 @@ import { Injectable } from '@nestjs/common'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { MessageChannelSyncStatusService } from 'src/modules/messaging/common/services/message-channel-sync-status.service'; import { MessageChannelWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel.workspace-entity'; @@ -25,6 +26,7 @@ export class MessageImportExceptionHandlerService { constructor( private readonly twentyORMManager: TwentyORMManager, private readonly messageChannelSyncStatusService: MessageChannelSyncStatusService, + private readonly exceptionHandlerService: ExceptionHandlerService, ) {} public async handleDriverException( @@ -152,6 +154,10 @@ export class MessageImportExceptionHandlerService { workspaceId, ); + this.exceptionHandlerService.captureExceptions([ + `Unknown error occurred while importing messages for message channel ${messageChannel.id} in workspace ${workspaceId}: ${exception.message}`, + ]); + throw new MessageImportException( `Unknown error occurred while importing messages for message channel ${messageChannel.id} in workspace ${workspaceId}: ${exception.message}`, MessageImportExceptionCode.UNKNOWN,