Skip to content

Commit

Permalink
catch NODATA response when generating cache
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Twydell <[email protected]>
  • Loading branch information
AndrewTwydell committed Jan 9, 2025
1 parent 63501a8 commit 8d57393
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
1 change: 1 addition & 0 deletions packages/vsce/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to the "cics-extension-for-zowe" extension will be documente

- BugFix: Remove create profile gif from readme. [#33](https://github.com/zowe/cics-for-zowe-client/issues/33)
- BugFix: Handle getCache returning non-array. [#178](https://github.com/zowe/cics-for-zowe-client/issues/178)
- BugFix: Inform user no resources found when filtering trees. [#200](https://github.com/zowe/cics-for-zowe-client/issues/200)

## `3.2.4`

Expand Down
36 changes: 22 additions & 14 deletions packages/vsce/src/utils/profileManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,21 +312,29 @@ export class ProfileManagement {
group?: string
): Promise<{ cacheToken: string; recordCount: number; }> {
const session = this.getSessionFromProfile(profile.profile);
const allProgramsResponse = await getResource(session, {
name: resourceName,
cicsPlex: plexName,
...group ? { regionName: group } : {},
criteria: criteria,
queryParams: {
summonly: true,
nodiscard: true,
overrideWarningCount: true,
try {
const allProgramsResponse = await getResource(session, {
name: resourceName,
cicsPlex: plexName,
...group ? { regionName: group } : {},
criteria: criteria,
queryParams: {
summonly: true,
nodiscard: true,
overrideWarningCount: true,
}
});
if (allProgramsResponse.response.resultsummary.api_response1_alt === "OK") {
if (allProgramsResponse.response && allProgramsResponse.response.resultsummary) {
const resultsSummary = allProgramsResponse.response.resultsummary;
return { cacheToken: resultsSummary.cachetoken, recordCount: parseInt(resultsSummary.recordcount, 10) };
}
}
});
if (allProgramsResponse.response.resultsummary.api_response1_alt === "OK") {
if (allProgramsResponse.response && allProgramsResponse.response.resultsummary) {
const resultsSummary = allProgramsResponse.response.resultsummary;
return { cacheToken: resultsSummary.cachetoken, recordCount: parseInt(resultsSummary.recordcount, 10) };
} catch (error) {
if (error instanceof imperative.ImperativeError) {
if (!error.mDetails.msg.toUpperCase().includes("NODATA")) {
throw error;
}
}
}
return { cacheToken: null, recordCount: 0 };
Expand Down

0 comments on commit 8d57393

Please sign in to comment.