Handle Microsoft calendar sync cursor error (#15938)
Resolves https://twenty-v7.sentry.io/issues/6567295627
This commit is contained in:
+1
@@ -6,6 +6,7 @@ export enum CalendarEventImportDriverExceptionCode {
|
||||
NOT_FOUND = 'NOT_FOUND',
|
||||
TEMPORARY_ERROR = 'TEMPORARY_ERROR',
|
||||
INSUFFICIENT_PERMISSIONS = 'INSUFFICIENT_PERMISSIONS',
|
||||
SYNC_CURSOR_ERROR = 'SYNC_CURSOR_ERROR',
|
||||
UNKNOWN = 'UNKNOWN',
|
||||
UNKNOWN_NETWORK_ERROR = 'UNKNOWN_NETWORK_ERROR',
|
||||
}
|
||||
|
||||
+6
@@ -33,6 +33,12 @@ export const parseMicrosoftCalendarError = (
|
||||
CalendarEventImportDriverExceptionCode.NOT_FOUND,
|
||||
);
|
||||
|
||||
case 410:
|
||||
return new CalendarEventImportDriverException(
|
||||
message,
|
||||
CalendarEventImportDriverExceptionCode.SYNC_CURSOR_ERROR,
|
||||
);
|
||||
|
||||
case 429:
|
||||
return new CalendarEventImportDriverException(
|
||||
message,
|
||||
|
||||
+17
@@ -64,6 +64,9 @@ export class CalendarEventImportErrorHandlerService {
|
||||
workspaceId,
|
||||
);
|
||||
break;
|
||||
case CalendarEventImportDriverExceptionCode.SYNC_CURSOR_ERROR:
|
||||
await this.handleSyncCursorErrorException(calendarChannel, workspaceId);
|
||||
break;
|
||||
case CalendarEventImportDriverExceptionCode.UNKNOWN:
|
||||
case CalendarEventImportDriverExceptionCode.UNKNOWN_NETWORK_ERROR:
|
||||
default:
|
||||
@@ -76,6 +79,20 @@ export class CalendarEventImportErrorHandlerService {
|
||||
}
|
||||
}
|
||||
|
||||
private async handleSyncCursorErrorException(
|
||||
calendarChannel: Pick<CalendarChannelWorkspaceEntity, 'id'>,
|
||||
workspaceId: string,
|
||||
): Promise<void> {
|
||||
this.logger.log(
|
||||
`CalendarChannelId: ${calendarChannel.id} - Sync cursor error, resetting and rescheduling`,
|
||||
);
|
||||
|
||||
await this.calendarChannelSyncStatusService.resetAndScheduleCalendarEventListFetch(
|
||||
[calendarChannel.id],
|
||||
workspaceId,
|
||||
);
|
||||
}
|
||||
|
||||
private async handleTemporaryException(
|
||||
syncStep: CalendarEventImportSyncStep,
|
||||
calendarChannel: Pick<
|
||||
|
||||
Reference in New Issue
Block a user