Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions packages/vsce/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to the "zowex-vsce" extension will be documented in this fil

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## Recent Changes

- Fixed error handling of methods in `SshMvsApi` class so that errors are thrown and propagated to extenders. [#917](https://github.com/zowe/zowex/issues/917)

## `0.5.0`

- **Breaking:** Renamed contributed setting IDs from `zowe-native-proto` to `zowex`. All references to `zowe-native-proto` should be replaced with `zowex` in VS Code `settings.json` files. [#831](https://github.com/zowe/zowex/issues/831)
Expand Down
53 changes: 14 additions & 39 deletions packages/vsce/src/api/SshMvsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
type AttributeInfo,
type DataSetAttributesProvider,
type DsInfo,
Gui,
type IAttributesProvider,
imperative,
type MainframeInteraction,
Expand Down Expand Up @@ -285,9 +284,9 @@ export class SshMvsApi extends SshCommonApi implements MainframeInteraction.IMvs
attributes: datasetAttributes,
});
} catch (error) {
if (error instanceof imperative.ImperativeError) {
Gui.errorMessage(error.additionalDetails);
}
throw error instanceof imperative.ImperativeError
? new Error(`${error.message}\n${error.additionalDetails}`)
: error;
Comment thread
t1m0thyj marked this conversation as resolved.
Outdated
}
return this.buildZosFilesResponse(response, response.success);
}
Expand All @@ -296,19 +295,10 @@ export class SshMvsApi extends SshCommonApi implements MainframeInteraction.IMvs
dataSetName: string,
_options?: zosfiles.IUploadOptions,
): Promise<zosfiles.IZosFilesResponse> {
let response: ds.CreateMemberResponse = { success: false };
try {
response = await (await this.client).ds.createMember({
dsname: dataSetName,
overwrite: true, // Overwrite detection already handled on client side
});
if (!response.success) {
Gui.errorMessage(`Failed to create data set member: ${dataSetName}`);
}
} catch (error) {
Gui.errorMessage(`Failed to create data set member: ${dataSetName}`);
Gui.errorMessage(`Error: ${error}`);
}
const response = await (await this.client).ds.createMember({
dsname: dataSetName,
overwrite: true, // Overwrite detection already handled on client side

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) I understand the premise of the comment, but in the future I wonder if this is better suited for the TSDoc within Zowe Explorer API's extender interfaces. The comment is definitely accurate, but this isn't behavior exclusive to ZRS, and this info could help steer other extenders that implement this function.

@t1m0thyj t1m0thyj May 4, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good point, but after discussing offline I'm not sure that it warrants a separate PR for Zowe Explorer at this time 😋

});
return this.buildZosFilesResponse(response, response.success);
}

Expand All @@ -335,9 +325,7 @@ export class SshMvsApi extends SshCommonApi implements MainframeInteraction.IMvs
dsnameBefore: currentDataSetName,
dsnameAfter: newDataSetName,
});
return this.buildZosFilesResponse({
success: response.success,
});
return this.buildZosFilesResponse(response, response.success);
}

public async renameDataSetMember(
Expand All @@ -350,29 +338,18 @@ export class SshMvsApi extends SshCommonApi implements MainframeInteraction.IMvs
memberBefore,
memberAfter,
});
return this.buildZosFilesResponse({
success: response.success,
});
return this.buildZosFilesResponse(response, response.success);
}

public async hMigrateDataSet(_dataSetName: string): Promise<zosfiles.IZosFilesResponse> {
throw new Error("Not yet implemented");
}

public async hRecallDataSet(dataSetName: string): Promise<zosfiles.IZosFilesResponse> {
let response: ds.RestoreDatasetResponse = { success: false };
try {
response = await (await this.client).ds.restoreDataset({
dsname: dataSetName,
});
if (!response.success) {
Gui.errorMessage(`Failed to restore dataset ${dataSetName}`);
}
} catch (error) {
Gui.errorMessage(`Failed to restore dataset ${dataSetName}`);
Gui.errorMessage(`Error: ${error}`);
}
return this.buildZosFilesResponse(response);
const response = await (await this.client).ds.restoreDataset({
dsname: dataSetName,
});
return this.buildZosFilesResponse(response, response.success);
}

public async deleteDataSet(
Expand All @@ -382,9 +359,7 @@ export class SshMvsApi extends SshCommonApi implements MainframeInteraction.IMvs
const response = await (await this.client).ds.deleteDataset({
dsname: dataSetName,
});
return this.buildZosFilesResponse({
success: response.success,
});
return this.buildZosFilesResponse(response, response.success);
}

// biome-ignore lint/suspicious/noExplicitAny: apiResponse has no strong type
Expand Down
Loading