From 43eba14db5bb62bebd89120b7e5ac904692256f7 Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Wed, 18 Dec 2024 18:45:03 -0500 Subject: [PATCH] refactor: 'promptForAuthOnError' -> 'lockProfileOnAuthError' Signed-off-by: Trae Yelovich --- .../zowe-explorer/src/trees/dataset/DatasetFSProvider.ts | 2 +- packages/zowe-explorer/src/trees/job/JobFSProvider.ts | 2 +- packages/zowe-explorer/src/trees/uss/UssFSProvider.ts | 2 +- packages/zowe-explorer/src/utils/AuthUtils.ts | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/zowe-explorer/src/trees/dataset/DatasetFSProvider.ts b/packages/zowe-explorer/src/trees/dataset/DatasetFSProvider.ts index 955a3a8d1..2a84437e9 100644 --- a/packages/zowe-explorer/src/trees/dataset/DatasetFSProvider.ts +++ b/packages/zowe-explorer/src/trees/dataset/DatasetFSProvider.ts @@ -433,7 +433,7 @@ export class DatasetFSProvider extends BaseProvider implements vscode.FileSystem } catch (error) { //Response will error if the file is not found //Callers of fetchDatasetAtUri() do not expect it to throw an error - await AuthUtils.promptForAuthOnError(error, metadata.profile); + await AuthUtils.lockProfileOnAuthError(error, metadata.profile); return null; } } diff --git a/packages/zowe-explorer/src/trees/job/JobFSProvider.ts b/packages/zowe-explorer/src/trees/job/JobFSProvider.ts index a3e14f223..8dbf564a1 100644 --- a/packages/zowe-explorer/src/trees/job/JobFSProvider.ts +++ b/packages/zowe-explorer/src/trees/job/JobFSProvider.ts @@ -227,7 +227,7 @@ export class JobFSProvider extends BaseProvider implements vscode.FileSystemProv bufBuilder.write(await jesApi.getSpoolContentById(jobEntry.job.jobname, jobEntry.job.jobid, spoolEntry.spool.id)); } } catch (err) { - await AuthUtils.promptForAuthOnError(err, spoolEntry.metadata.profile); + await AuthUtils.lockProfileOnAuthError(err, spoolEntry.metadata.profile); throw err; } diff --git a/packages/zowe-explorer/src/trees/uss/UssFSProvider.ts b/packages/zowe-explorer/src/trees/uss/UssFSProvider.ts index 543957539..d8dc4374e 100644 --- a/packages/zowe-explorer/src/trees/uss/UssFSProvider.ts +++ b/packages/zowe-explorer/src/trees/uss/UssFSProvider.ts @@ -290,7 +290,7 @@ export class UssFSProvider extends BaseProvider implements vscode.FileSystemProv if (err instanceof Error) { ZoweLogger.error(err.message); } - await AuthUtils.promptForAuthOnError(err, metadata.profile); + await AuthUtils.lockProfileOnAuthError(err, metadata.profile); return; } diff --git a/packages/zowe-explorer/src/utils/AuthUtils.ts b/packages/zowe-explorer/src/utils/AuthUtils.ts index aa627276a..fd80bddbd 100644 --- a/packages/zowe-explorer/src/utils/AuthUtils.ts +++ b/packages/zowe-explorer/src/utils/AuthUtils.ts @@ -24,7 +24,7 @@ interface ErrorContext { } export class AuthUtils { - public static async promptForAuthOnError(err: Error, profile: imperative.IProfileLoaded): Promise { + public static async lockProfileOnAuthError(err: Error, profile: imperative.IProfileLoaded): Promise { if ( err instanceof imperative.ImperativeError && profile != null && @@ -36,12 +36,12 @@ export class AuthUtils { profileName: profile.name, }, }); - await AuthHandler.promptForAuthentication(err, profile, { + await AuthHandler.lockProfile(profile, err, { ssoLogin: Constants.PROFILES_CACHE.ssoLogin.bind(Constants.PROFILES_CACHE), promptCredentials: Constants.PROFILES_CACHE.promptCredentials.bind(Constants.PROFILES_CACHE), isUsingTokenAuth: await AuthUtils.isUsingTokenAuth(profile.name), errorCorrelation, - }).catch((error) => error instanceof Error && ZoweLogger.error(error.message)); + }); } }