From f91c2bb729f97bdd234f04eaa3d640abe4293252 Mon Sep 17 00:00:00 2001 From: neo773 <62795688+neo773@users.noreply.github.com> Date: Fri, 7 Nov 2025 20:23:26 +0530 Subject: [PATCH] fix exceptionHandlerService.captureExceptions in MessageImportExceptionHandlerService (#15703) --- ...messaging-import-exception-handler.service.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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 15355859b9..02013355ca 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 @@ -50,10 +50,6 @@ export class MessageImportExceptionHandlerService { }; } - this.exceptionHandlerService.captureExceptions([exception], { - workspace: { id: workspaceId }, - }); - if ('code' in exception) { switch (exception.code) { case MessageImportDriverExceptionCode.NOT_FOUND: @@ -90,11 +86,15 @@ export class MessageImportExceptionHandlerService { case MessageImportDriverExceptionCode.UNKNOWN: case MessageImportDriverExceptionCode.UNKNOWN_NETWORK_ERROR: default: - await this.handleUnknownException(messageChannel, workspaceId); + await this.handleUnknownException( + exception, + messageChannel, + workspaceId, + ); break; } } else { - await this.handleUnknownException(messageChannel, workspaceId); + await this.handleUnknownException(exception, messageChannel, workspaceId); } } @@ -177,9 +177,13 @@ export class MessageImportExceptionHandlerService { } private async handleUnknownException( + exception: Error, messageChannel: Pick, workspaceId: string, ): Promise { + this.exceptionHandlerService.captureExceptions([exception], { + workspace: { id: workspaceId }, + }); await this.messageChannelSyncStatusService.markAsFailed( [messageChannel.id], workspaceId,