Skip to content

Commit

Permalink
Add error handling in GmailPartialSyncService (#4248)
Browse files Browse the repository at this point in the history
* Add error handling in GmailPartialSyncService

* improve typing
  • Loading branch information
bosiraphael authored Feb 29, 2024
1 parent 6670ecd commit 773f698
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ export class GmailPartialSyncService {
return;
}

if (error) {
throw new Error(
`Error getting history for ${connectedAccountId} in workspace ${workspaceId} during partial-sync:
${JSON.stringify(error)}`,
);
}

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

0 comments on commit 773f698

Please sign in to comment.