From 9a4fff5f56e562d9fa4217a61d05050d148d08e9 Mon Sep 17 00:00:00 2001 From: Gaston Yelmini Date: Mon, 9 Oct 2023 12:48:00 -0300 Subject: [PATCH] INT-9705: add throwMissingPermissionError flag for edge cases --- src/google-cloud/client.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/google-cloud/client.ts b/src/google-cloud/client.ts index 839cc1a7..73c4a6ae 100644 --- a/src/google-cloud/client.ts +++ b/src/google-cloud/client.ts @@ -96,6 +96,7 @@ export class Client { async iterateApi( fn: (nextPageToken?: string) => Promise>, callback: (data: T) => Promise, + throwMissingPermissionError?: boolean, ) { return this.forEachPage(async (nextPageToken) => { try { @@ -114,6 +115,9 @@ export class Client { name: IntegrationWarnEventName.MissingPermission, description: `Received authorization error when attempting to call ${err.endpoint}. Please review permissions in the integration documentation.`, }); + + if (throwMissingPermissionError) throw err; + return; }