Skip to content

Commit

Permalink
error handling to catch certificate issues
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Twydell <[email protected]>
  • Loading branch information
AndrewTwydell committed Jan 6, 2025
1 parent 312bef2 commit 2509799
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions packages/vsce/src/utils/profileManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ export class ProfileManagement {
if (`${error.mDetails.errorCode}` === "404") {
return null;
}
window.showErrorMessage(
`${error.causeErrors.code} - ${error.causeErrors.message}`,
);
} else {
window.showErrorMessage(
`Error getting CICSCICSPlex resource - ${JSON.stringify(error)}`,
);
}
throw error;
}
Expand Down Expand Up @@ -218,15 +225,29 @@ export class ProfileManagement {
});
}
} else {
// TODO: Error checking!!
const singleRegion = await getResource(session, {
name: "CICSRegion",
});
infoLoaded.push({
plexname: null,
regions: toArray(singleRegion.response.records.cicsregion),
group: false,
});
try {
const singleRegion = await getResource(session, {
name: "CICSRegion",
});
infoLoaded.push({
plexname: null,
regions: toArray(singleRegion.response.records.cicsregion),
group: false,
});
} catch (error) {
if (error instanceof imperative.RestClientError) {
if (`${error.mDetails.errorCode}` === "404") {
window.showErrorMessage(
`CMCI Endpoint not found - ${error.mDetails.protocol}://${error.mDetails.host}:${error.mDetails.port}${error.mDetails.resource}`,
);
}
} else {
window.showErrorMessage(
`Error making request - ${JSON.stringify(error)}`,
);
}
throw error;
}
}

return infoLoaded;
Expand Down

0 comments on commit 2509799

Please sign in to comment.