Add error handling in GmailPartialSyncService (#4248)

* Add error handling in GmailPartialSyncService

* improve typing
This commit is contained in:
bosiraphael
2024-02-29 18:11:53 +01:00
committed by GitHub
parent 6670ecdfda
commit 773f698faf

View File

@ -97,6 +97,13 @@ export class GmailPartialSyncService {
return; return;
} }
if (error) {
throw new Error(
`Error getting history for ${connectedAccountId} in workspace ${workspaceId} during partial-sync:
${JSON.stringify(error)}`,
);
}
if (!historyId) { if (!historyId) {
throw new Error( throw new Error(
`No historyId found for ${connectedAccountId} in workspace ${workspaceId} during partial-sync`, `No historyId found for ${connectedAccountId} in workspace ${workspaceId} during partial-sync`,
@ -254,7 +261,17 @@ export class GmailPartialSyncService {
): Promise<{ ): Promise<{
history: gmail_v1.Schema$History[]; history: gmail_v1.Schema$History[];
historyId?: string | null; historyId?: string | null;
error?: any; error?: {
code: number;
errors: {
domain: string;
reason: string;
message: string;
locationType?: string;
location?: string;
}[];
message: string;
};
}> { }> {
const gmailClient = const gmailClient =
await this.gmailClientProvider.getGmailClient(refreshToken); await this.gmailClientProvider.getGmailClient(refreshToken);