Handle Network errors in messaging sync
This commit is contained in:
@ -18,7 +18,7 @@ type SyncStep =
|
|||||||
| 'messages-import';
|
| 'messages-import';
|
||||||
|
|
||||||
export type GmailError = {
|
export type GmailError = {
|
||||||
code: number;
|
code: number | string;
|
||||||
reason: string;
|
reason: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -94,7 +94,21 @@ export class MessagingErrorHandlingService {
|
|||||||
workspaceId,
|
workspaceId,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
case 'ECONNRESET':
|
||||||
|
case 'ENOTFOUND':
|
||||||
|
case 'ECONNABORTED':
|
||||||
|
case 'ETIMEDOUT':
|
||||||
|
case 'ERR_NETWORK':
|
||||||
|
// We are currently mixing up Gmail Error code (HTTP status) and axios error code (ECONNRESET)
|
||||||
|
|
||||||
|
// In case of a network error, we should retry the request
|
||||||
|
await this.handleRateLimitExceeded(
|
||||||
|
error,
|
||||||
|
syncStep,
|
||||||
|
messageChannel,
|
||||||
|
workspaceId,
|
||||||
|
);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
await this.messagingChannelSyncStatusService.markAsFailedUnknownAndFlushMessagesToImport(
|
await this.messagingChannelSyncStatusService.markAsFailedUnknownAndFlushMessagesToImport(
|
||||||
messageChannel.id,
|
messageChannel.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user