From 77e2ac5744174f5edf46e0552103d3bfc3c81b79 Mon Sep 17 00:00:00 2001 From: Gaston Yelmini Date: Mon, 11 Dec 2023 11:45:12 -0300 Subject: [PATCH] Update missing error catch --- src/steps/groups/index.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/steps/groups/index.ts b/src/steps/groups/index.ts index c64f2de..177e106 100644 --- a/src/steps/groups/index.ts +++ b/src/steps/groups/index.ts @@ -32,7 +32,6 @@ import { createGroupSettingsEntity, MemberType, } from './converters'; -import { authorizationErrorResponses } from '../../gsuite/clients/GSuiteClient'; import { isAuthorizationError } from '../../utils/isAuthorizationError'; const GROUPS_LOG_INTERVAL = 50; @@ -127,9 +126,7 @@ async function iterateGroupMembers( } catch (err) { if ( err instanceof IntegrationProviderAuthorizationError && - authorizationErrorResponses.filter((errorText) => - err.statusText.match(errorText), - ).length > 0 + isAuthorizationError(err.statusText) ) { context.logger.publishWarnEvent({ name: IntegrationWarnEventName.MissingPermission, @@ -324,9 +321,7 @@ export async function fetchGroupSettings( } catch (err) { if ( err instanceof IntegrationProviderAuthorizationError && - authorizationErrorResponses.filter((errorText) => - err.statusText.match(errorText), - ).length > 0 + isAuthorizationError(err.statusText) ) { context.logger.publishWarnEvent({ name: IntegrationWarnEventName.MissingPermission,