Skip to content

Commit 01c0378

Browse files
committed
Handle Network errors in messaging sync
1 parent e4a4499 commit 01c0378

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

packages/twenty-server/src/modules/messaging/common/services/messaging-error-handling.service.ts

+16-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type SyncStep =
1818
| 'messages-import';
1919

2020
export type GmailError = {
21-
code: number;
21+
code: number | string;
2222
reason: string;
2323
};
2424

@@ -94,7 +94,21 @@ export class MessagingErrorHandlingService {
9494
workspaceId,
9595
);
9696
break;
97-
97+
case 'ECONNRESET':
98+
case 'ENOTFOUND':
99+
case 'ECONNABORTED':
100+
case 'ETIMEDOUT':
101+
case 'ERR_NETWORK':
102+
// We are currently mixing up Gmail Error code (HTTP status) and axios error code (ECONNRESET)
103+
104+
// In case of a network error, we should retry the request
105+
await this.handleRateLimitExceeded(
106+
error,
107+
syncStep,
108+
messageChannel,
109+
workspaceId,
110+
);
111+
break;
98112
default:
99113
await this.messagingChannelSyncStatusService.markAsFailedUnknownAndFlushMessagesToImport(
100114
messageChannel.id,

0 commit comments

Comments
 (0)