-
Notifications
You must be signed in to change notification settings - Fork 5
fix(vsce): Don't swallow errors for createDataset #927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,6 @@ import { | |
| type AttributeInfo, | ||
| type DataSetAttributesProvider, | ||
| type DsInfo, | ||
| Gui, | ||
| type IAttributesProvider, | ||
| imperative, | ||
| type MainframeInteraction, | ||
|
|
@@ -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; | ||
| } | ||
| return this.buildZosFilesResponse(response, response.success); | ||
| } | ||
|
|
@@ -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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
| } | ||
|
|
||
|
|
@@ -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( | ||
|
|
@@ -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( | ||
|
|
@@ -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 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.