Skip to content

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/twenty-server/src/modules/messaging/message-import-manager/drivers/imap/providers/imap-client.provider.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { isDefined } from 'twenty-shared/utils';
66

77
import { type ImapSmtpCaldavParams } from 'src/engine/core-modules/imap-smtp-caldav-connection/types/imap-smtp-caldav-connection.type';
88
import { type ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity';
9+
import { MessageImportDriverExceptionCode } from 'src/modules/messaging/message-import-manager/drivers/exceptions/message-import-driver.exception';
10+
import { CustomError } from 'src/utils/custom-error';
911

1012
type ConnectedAccountIdentifier = Pick<
1113
ConnectedAccountWorkspaceEntity,
@@ -82,6 +84,12 @@ export class ImapClientProvider {
8284
let client: ImapFlow | null = null;
8385
let timeoutId: NodeJS.Timeout | null = null;
8486

87+
if (!isDefined(connectedAccount.handle)) {
88+
throw new CustomError(
89+
'Handle is required',
90+
MessageImportDriverExceptionCode.CHANNEL_MISCONFIGURED,
91+
);
92+
}
8593
try {
8694
client = new ImapFlow({
8795
host: connectionParameters.IMAP?.host || '',

0 commit comments

Comments
 (0)