Skip to content

Commit

Permalink
fix: reset wasAccessed flag if ImperativeError caught
Browse files Browse the repository at this point in the history
Signed-off-by: Trae Yelovich <[email protected]>
  • Loading branch information
traeok committed Nov 14, 2024
1 parent d85b493 commit 9166b58
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

import { imperative } from "@zowe/zowe-explorer-api";
import { AuthUtils } from "../../../src/utils/AuthUtils";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ export class DatasetFSProvider extends BaseProvider implements vscode.FileSystem
//Callers of fetchDatasetAtUri() do not expect it to throw an error
if (error instanceof imperative.ImperativeError) {
AuthUtils.promptForAuthError(error, metadata.profile);
dsEntry.wasAccessed = false;
}
return null;
}
Expand Down
6 changes: 5 additions & 1 deletion packages/zowe-explorer/src/trees/job/JobFSProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
ZoweScheme,
FsJobsUtils,
FsAbstractUtils,
imperative,
} from "@zowe/zowe-explorer-api";
import { IJob, IJobFile } from "@zowe/zos-jobs-for-zowe-sdk";
import { Profiles } from "../../configuration/Profiles";
Expand Down Expand Up @@ -205,7 +206,10 @@ export class JobFSProvider extends BaseProvider implements vscode.FileSystemProv
bufBuilder.write(await jesApi.getSpoolContentById(jobEntry.job.jobname, jobEntry.job.jobid, spoolEntry.spool.id));
}
} catch (err) {
AuthUtils.promptForAuthError(err, spoolEntry.metadata.profile);
if (err instanceof imperative.ImperativeError) {
AuthUtils.promptForAuthError(err, spoolEntry.metadata.profile);
spoolEntry.wasAccessed = false;
}
throw err;
}

Expand Down
5 changes: 4 additions & 1 deletion packages/zowe-explorer/src/trees/uss/UssFSProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,10 @@ export class UssFSProvider extends BaseProvider implements vscode.FileSystemProv
if (err instanceof Error) {
ZoweLogger.error(err.message);
}
AuthUtils.promptForAuthError(err, metadata.profile);
if (err instanceof imperative.ImperativeError) {
AuthUtils.promptForAuthError(err, metadata.profile);
file.wasAccessed = false;
}
return;
}

Expand Down

0 comments on commit 9166b58

Please sign in to comment.