Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen

### Bug fixes

- Fixed an issue where deleting an open PDS resulted in an error. [#3908](https://github.com/zowe/zowe-explorer-vscode/pull/3908)
- Fixed an issue where `ssh` type profiles were throwing errors when making file system calls. [#3891](https://github.com/zowe/zowe-explorer-vscode/pull/3891)
- Fixed duplicate credential prompts that occurred when logging out of SSO with multiple virtual workspaces open. [#3858](https://github.com/zowe/zowe-explorer-vscode/issues/3858)
- Fixed race conditions in parallel file system calls made with invalid credentials. [#3830](https://github.com/zowe/zowe-explorer-vscode/pull/3830)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ export class ImperativeError extends Error {
public get details() {
return this.mDetails;
}
public get errorCode() {
return this.mDetails.errorCode;
}
}

export class ProfInfoErr extends ImperativeError {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1909,4 +1909,21 @@ describe("ZoweDatasetNode Unit Tests - listMembersInRange()", () => {
expect(result.totalItems).toBe(42);
expect(listDatasetsMock).toHaveBeenCalledTimes(1);
});
it("returns an empty list, if listMembersInRange throws a 404 error", async () => {
const pdsNode = new ZoweDatasetNode({
label: "PDS.404",
collapsibleState: vscode.TreeItemCollapsibleState.Expanded,
contextOverride: Constants.DS_PDS_CONTEXT,
});

jest.spyOn(pdsNode, "listMembers").mockRejectedValueOnce(
new imperative.ImperativeError({
msg: "Dataset not cataloged",
errorCode: `${imperative.RestConstants.HTTP_STATUS_404}`,
})
);

const result = await (pdsNode as any).listMembersInRange(undefined, 2);
expect(result).toStrictEqual({ items: [] });
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -516,17 +516,17 @@ describe("UssFSProvider", () => {
expect(_updateResourceInEditorMock).toHaveBeenCalledWith(testUris.file);
autoDetectEncodingMock.mockRestore();
});
it("returns null when a 401 error is encountered", async () => {
it("returns null when an error that is not 401 is encountered", async () => {
const fileEntry = { ...testEntries.file };
jest.spyOn((UssFSProvider as any).prototype, "_lookupAsFile").mockReturnValueOnce(fileEntry);
const autoDetectEncodingMock = jest.spyOn(UssFSProvider.instance, "autoDetectEncoding").mockImplementation();
const error401 = new imperative.ImperativeError({
const error404 = new imperative.ImperativeError({
msg: "Username or password are not valid or expired",
errorCode: `${imperative.RestConstants.HTTP_STATUS_401}`,
errorCode: `${imperative.RestConstants.HTTP_STATUS_404}`,
});
const loggerErrorSpy = jest.spyOn(ZoweLogger, "error");
jest.spyOn(ZoweExplorerApiRegister, "getUssApi").mockReturnValueOnce({
getContents: jest.fn().mockRejectedValue(error401),
getContents: jest.fn().mockRejectedValue(error404),
} as any);

const result = await UssFSProvider.instance.fetchFileAtUri(testUris.file);
Expand Down
3 changes: 3 additions & 0 deletions packages/zowe-explorer/src/trees/dataset/ZoweDatasetNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,9 @@ export class ZoweDatasetNode extends ZoweTreeNode implements IZoweDatasetTreeNod

await this.listMembers(responses, { attributes: true, start, maxLength: start ? limit + 1 : limit });
} catch (err) {
if (err instanceof imperative.ImperativeError && Number(err.errorCode) === imperative.RestConstants.HTTP_STATUS_404) {
return { items: [] };
}
const updated = await AuthUtils.errorHandling(err, {
apiType: ZoweExplorerApiType.Mvs,
profile: this.getProfile(),
Expand Down