diff --git a/packages/twenty-server/src/database/typeorm-seeds/workspace/message-channels.ts b/packages/twenty-server/src/database/typeorm-seeds/workspace/message-channels.ts index e27909ec59b1..f948b5d9d017 100644 --- a/packages/twenty-server/src/database/typeorm-seeds/workspace/message-channels.ts +++ b/packages/twenty-server/src/database/typeorm-seeds/workspace/message-channels.ts @@ -44,6 +44,7 @@ export const seedMessageChannel = async ( type: 'email', connectedAccountId: DEV_SEED_CONNECTED_ACCOUNT_IDS.TIM, handle: 'tim@apple.dev', + isSyncEnabled: false, visibility: MessageChannelVisibility.SHARE_EVERYTHING, syncSubStatus: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, }, @@ -56,6 +57,7 @@ export const seedMessageChannel = async ( type: 'email', connectedAccountId: DEV_SEED_CONNECTED_ACCOUNT_IDS.JONY, handle: 'jony.ive@apple.dev', + isSyncEnabled: false, visibility: MessageChannelVisibility.SHARE_EVERYTHING, syncSubStatus: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, }, @@ -68,6 +70,7 @@ export const seedMessageChannel = async ( type: 'email', connectedAccountId: DEV_SEED_CONNECTED_ACCOUNT_IDS.PHIL, handle: 'phil.schiler@apple.dev', + isSyncEnabled: false, visibility: MessageChannelVisibility.SHARE_EVERYTHING, syncSubStatus: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, }, diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/exceptions/message-import-driver.exception.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/exceptions/message-import-driver.exception.ts index 123b1558639b..a0fc4cb04000 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/exceptions/message-import-driver.exception.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/exceptions/message-import-driver.exception.ts @@ -15,5 +15,4 @@ export enum MessageImportDriverExceptionCode { UNKNOWN_NETWORK_ERROR = 'UNKNOWN_NETWORK_ERROR', NO_NEXT_SYNC_CURSOR = 'NO_NEXT_SYNC_CURSOR', SYNC_CURSOR_ERROR = 'SYNC_CURSOR_ERROR', - EXAMPLE_ACCOUNT = 'EXAMPLE_ACCOUNT', } diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/services/gmail-get-message-list.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/services/gmail-get-message-list.service.ts index b4ab3e3a82be..f2a761c7017f 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/services/gmail-get-message-list.service.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/services/gmail-get-message-list.service.ts @@ -55,15 +55,11 @@ export class GmailGetMessageListService { }) .catch((error) => { if (connectedAccount.refreshToken === 'exampleRefreshToken') { - throw new MessageImportDriverException( + console.log( `Gmail ${connectedAccount.handle} for connected account ${connectedAccount.id} not found. You probably use an example account, remove it`, - MessageImportDriverExceptionCode.EXAMPLE_ACCOUNT, - ); - } else { - this.gmailHandleErrorService.handleGmailMessageListFetchError( - error, ); } + this.gmailHandleErrorService.handleGmailMessageListFetchError(error); return { data: { diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/services/message-import-exception-handler.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/services/message-import-exception-handler.service.ts index e40fdf67daa8..faaccee96e46 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/services/message-import-exception-handler.service.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/services/message-import-exception-handler.service.ts @@ -65,14 +65,7 @@ export class MessageImportExceptionHandlerService { ); break; case MessageImportDriverExceptionCode.SYNC_CURSOR_ERROR: - await this.handleSyncCursorException( - exception, - messageChannel, - workspaceId, - ); - break; - case MessageImportDriverExceptionCode.EXAMPLE_ACCOUNT: - await this.handleExampleAccountException( + await this.handlePermanentException( exception, messageChannel, workspaceId, @@ -163,7 +156,7 @@ export class MessageImportExceptionHandlerService { ); } - private async handleSyncCursorException( + private async handlePermanentException( exception: MessageImportDriverException, messageChannel: Pick, workspaceId: string, @@ -173,25 +166,9 @@ export class MessageImportExceptionHandlerService { workspaceId, ); - throw new MessageImportDriverException( - `SyncCursor error occurred while importing messages for message channel ${messageChannel.id} in workspace ${workspaceId}: ${exception.message}`, - MessageImportDriverExceptionCode.SYNC_CURSOR_ERROR, - ); - } - - private async handleExampleAccountException( - exception: MessageImportDriverException, - messageChannel: Pick, - workspaceId: string, - ): Promise { - await this.messageChannelSyncStatusService.markAsFailedUnknownAndFlushMessagesToImport( - [messageChannel.id], - workspaceId, - ); - - throw new MessageImportDriverException( - `Unvalid Account error occurred while importing messages for message channel ${messageChannel.id} in workspace ${workspaceId}: ${exception.message}`, - MessageImportDriverExceptionCode.EXAMPLE_ACCOUNT, + throw new MessageImportException( + `Permanent error occurred while importing messages for message channel ${messageChannel.id} in workspace ${workspaceId}: ${exception.message}`, + MessageImportExceptionCode.UNKNOWN, ); }