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; }