better error handling for messaging import in case of unknown error (#11228)

This commit is contained in:
Guillim
2025-03-27 16:19:57 +01:00
committed by GitHub
parent 645d76fe69
commit 3b9e7c38eb

View File

@ -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,