Skip to content

The open alternative to Salesforce, designed for AI.

fix exceptionHandlerService.captureExceptions in MessageImportExceptionHandlerService (#15703)

neo773f91c2bb729f9
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 15355859b9b..02013355ca0 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<MessageChannelWorkspaceEntity, 'id'>,
workspaceId: string,
): Promise<void> {
+ this.exceptionHandlerService.captureExceptions([exception], {
+ workspace: { id: workspaceId },
+ });
await this.messageChannelSyncStatusService.markAsFailed(
[messageChannel.id],
workspaceId,