diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-event-import-exception-handler.service.ts b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-event-import-exception-handler.service.ts index 1356a7773..d04b886cf 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-event-import-exception-handler.service.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-event-import-exception-handler.service.ts @@ -58,14 +58,13 @@ export class CalendarEventImportErrorHandlerService { break; case CalendarEventImportDriverExceptionCode.UNKNOWN: case CalendarEventImportDriverExceptionCode.UNKNOWN_NETWORK_ERROR: + default: await this.handleUnknownException( exception, calendarChannel, workspaceId, ); break; - default: - throw exception; } } 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 f13796f48..388263728 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 @@ -104,6 +104,10 @@ export class MicrosoftGetMessagesService { ), ]; + const safeParticipantsFormat = participants.filter((participant) => { + return participant.handle.includes('@'); + }); + return { externalId: response.id, subject: response.subject || '', @@ -116,7 +120,7 @@ export class MicrosoftGetMessagesService { response.from.emailAddress.address, connectedAccount, ), - participants: participants, + participants: safeParticipantsFormat, attachments: [], }; }); diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-handle-error.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-handle-error.service.ts index 0659e2e02..75ca905fd 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-handle-error.service.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/services/microsoft-handle-error.service.ts @@ -1,7 +1,5 @@ import { Injectable } from '@nestjs/common'; -import { GraphError } from '@microsoft/microsoft-graph-client'; - import { MessageImportDriverException, MessageImportDriverExceptionCode, @@ -9,7 +7,7 @@ import { @Injectable() export class MicrosoftHandleErrorService { - public handleMicrosoftMessageFetchError(error: GraphError): void { + public handleMicrosoftMessageFetchError(error: any): void { if (!error.statusCode) { throw new MessageImportDriverException( `Microsoft Graph API unknown error: ${error}`, @@ -32,7 +30,7 @@ export class MicrosoftHandleErrorService { } throw new MessageImportDriverException( - `Microsoft Graph API error: ${error.message}`, + `Microsoft driver error: ${error.message}`, MessageImportDriverExceptionCode.UNKNOWN, ); } 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 61aa79d74..0064748dc 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 @@ -57,14 +57,6 @@ export class MessageImportExceptionHandlerService { workspaceId, ); break; - case MessageImportDriverExceptionCode.UNKNOWN: - case MessageImportDriverExceptionCode.UNKNOWN_NETWORK_ERROR: - await this.handleUnknownException( - exception, - messageChannel, - workspaceId, - ); - break; case MessageImportDriverExceptionCode.SYNC_CURSOR_ERROR: await this.handlePermanentException( exception, @@ -72,8 +64,15 @@ export class MessageImportExceptionHandlerService { workspaceId, ); break; + case MessageImportDriverExceptionCode.UNKNOWN: + case MessageImportDriverExceptionCode.UNKNOWN_NETWORK_ERROR: default: - throw exception; + await this.handleUnknownException( + exception, + messageChannel, + workspaceId, + ); + break; } } diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-messages-import.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-messages-import.service.ts index 181a0741e..10a156bf7 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-messages-import.service.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-messages-import.service.ts @@ -117,14 +117,6 @@ export class MessagingMessagesImportService { MESSAGING_GMAIL_USERS_MESSAGES_GET_BATCH_SIZE, ); - if (connectedAccount.id === '74998005-0180-4d6a-9fa4-fe733c4707f8') { - this.logger.log( - '[TMP] Debugging messages import for account:', - messageChannel.connectedAccount.id, - ); - this.logger.log('[TMP] messageIdsToFetch:', messageIdsToFetch); - } - if (!messageIdsToFetch?.length) { await this.messageChannelSyncStatusService.markAsCompletedAndSchedulePartialMessageListFetch( [messageChannel.id],