The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Fixing unhandled exception for microsoft driver (#10223)
Guillimbab529b1382f
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.tsindex b9a0bd0efd7..3bb7c301d9b 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@@ -134,7 +134,12 @@ export class MicrosoftGetMessagesService {return response.body;}- return { error: response.error };+ return {+ error: {+ ...response.body.error,+ statusCode: response.status,+ },+ };});}}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.tsindex 5c7560c425b..0659e2e0231 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@@ -10,6 +10,13 @@ import {@Injectable()export class MicrosoftHandleErrorService {public handleMicrosoftMessageFetchError(error: GraphError): void {+ if (!error.statusCode) {+ throw new MessageImportDriverException(+ `Microsoft Graph API unknown error: ${error}`,+ MessageImportDriverExceptionCode.UNKNOWN,+ );+ }+if (error.statusCode === 401) {throw new MessageImportDriverException('Unauthorized access to Microsoft Graph API',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.tsindex faaccee96e4..d942e8f2baa 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@@ -91,8 +91,10 @@ export class MessageImportExceptionHandlerService {[messageChannel.id],workspaceId,);-- return;+ throw new MessageImportException(+ `Unknown error occurred multiple times while importing messages for message channel ${messageChannel.id} in workspace ${workspaceId}`,+ MessageImportExceptionCode.UNKNOWN,+ );}const messageChannelRepository =