@ -20,11 +20,11 @@ export class GmailHandleErrorService {
|
|||||||
) {
|
) {
|
||||||
throw parseGaxiosError(error);
|
throw parseGaxiosError(error);
|
||||||
}
|
}
|
||||||
if (error.response?.status !== 410) {
|
if (error.code != 410) {
|
||||||
const gmailError = {
|
const gmailError = {
|
||||||
code: error.response?.status,
|
code: error.code,
|
||||||
reason: `${error.response?.data?.error?.errors?.[0].reason || error.response?.data?.error || ''}`,
|
reason: `${error?.errors?.[0].reason || error.response?.data?.error || ''}`,
|
||||||
message: `${error.response?.data?.error?.errors?.[0].message || error.response?.data?.error_description || ''}${messageExternalId ? ` for message with externalId: ${messageExternalId}` : ''}`,
|
message: `${error?.errors?.[0].message || error.response?.data?.error_description || ''}${messageExternalId ? ` for message with externalId: ${messageExternalId}` : ''}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
throw parseGmailError(gmailError);
|
throw parseGmailError(gmailError);
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager';
|
import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager';
|
||||||
import { CALENDAR_THROTTLE_MAX_ATTEMPTS } from 'src/modules/calendar/calendar-event-import-manager/constants/calendar-throttle-max-attempts';
|
|
||||||
import { MessageChannelSyncStatusService } from 'src/modules/messaging/common/services/message-channel-sync-status.service';
|
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';
|
import { MessageChannelWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel.workspace-entity';
|
||||||
|
import { MESSAGING_THROTTLE_MAX_ATTEMPTS } from 'src/modules/messaging/message-import-manager/constants/messaging-throttle-max-attempts';
|
||||||
import {
|
import {
|
||||||
MessageImportDriverException,
|
MessageImportDriverException,
|
||||||
MessageImportDriverExceptionCode,
|
MessageImportDriverExceptionCode,
|
||||||
@ -77,7 +77,9 @@ export class MessageImportExceptionHandlerService {
|
|||||||
>,
|
>,
|
||||||
workspaceId: string,
|
workspaceId: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
if (messageChannel.throttleFailureCount >= CALENDAR_THROTTLE_MAX_ATTEMPTS) {
|
if (
|
||||||
|
messageChannel.throttleFailureCount >= MESSAGING_THROTTLE_MAX_ATTEMPTS
|
||||||
|
) {
|
||||||
await this.messageChannelSyncStatusService.markAsFailedUnknownAndFlushMessagesToImport(
|
await this.messageChannelSyncStatusService.markAsFailedUnknownAndFlushMessagesToImport(
|
||||||
[messageChannel.id],
|
[messageChannel.id],
|
||||||
workspaceId,
|
workspaceId,
|
||||||
|
|||||||
@ -85,8 +85,8 @@ export class MessagingMessagesImportService {
|
|||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
switch (error.code) {
|
switch (error.code) {
|
||||||
case (RefreshAccessTokenExceptionCode.REFRESH_ACCESS_TOKEN_FAILED,
|
case RefreshAccessTokenExceptionCode.REFRESH_ACCESS_TOKEN_FAILED:
|
||||||
RefreshAccessTokenExceptionCode.REFRESH_TOKEN_NOT_FOUND):
|
case RefreshAccessTokenExceptionCode.REFRESH_TOKEN_NOT_FOUND:
|
||||||
await this.messagingTelemetryService.track({
|
await this.messagingTelemetryService.track({
|
||||||
eventName: `refresh_token.error.insufficient_permissions`,
|
eventName: `refresh_token.error.insufficient_permissions`,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
@ -191,7 +191,7 @@ export class MessagingMessagesImportService {
|
|||||||
|
|
||||||
await this.messageImportErrorHandlerService.handleDriverException(
|
await this.messageImportErrorHandlerService.handleDriverException(
|
||||||
error,
|
error,
|
||||||
MessageImportSyncStep.PARTIAL_MESSAGE_LIST_FETCH,
|
MessageImportSyncStep.MESSAGES_IMPORT,
|
||||||
messageChannel,
|
messageChannel,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user