Skip to content

Commit

Permalink
catch invalid region or plex inputs
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Twydell <[email protected]>
  • Loading branch information
AndrewTwydell committed Feb 5, 2025
1 parent 367814b commit ac10a1a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/vsce/src/utils/profileManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,12 @@ export class ProfileManagement {
}
} catch (error) {
let errorMessage = `Error requesting CICSManagedRegion - ${JSON.stringify(error)}`;
if (error instanceof CicsCmciRestError) {
if (
error instanceof CicsCmciRestError && (
error.RESPONSE_1 === CicsCmciConstants.RESPONSE_1_CODES.INVALIDPARM ||
error.RESPONSE_1 === CicsCmciConstants.RESPONSE_1_CODES.INVALIDDATA)) {
errorMessage = `Plex ${profile.cicsPlex} not found.`;
} else if (error instanceof CicsCmciRestError) {
errorMessage = `${error.RESPONSE_1_ALT} ${error.RESPONSE_2_ALT} requesting CICSManangedRegions.`;
} else if (error instanceof imperative.RestClientError) {
errorMessage = this.formatRestClientError(error);
Expand Down Expand Up @@ -271,7 +276,12 @@ export class ProfileManagement {
}
} catch (error) {
let errorMessage = `Error requesting CICSRegion - ${JSON.stringify(error)}`;
if (error instanceof CicsCmciRestError) {
if (
error instanceof CicsCmciRestError && (
error.RESPONSE_1 === CicsCmciConstants.RESPONSE_1_CODES.INVALIDPARM ||
error.RESPONSE_1 === CicsCmciConstants.RESPONSE_1_CODES.INVALIDDATA)) {
errorMessage = `Region ${profile.regionName} not found.`;
} else if (error instanceof CicsCmciRestError) {
errorMessage = `${error.RESPONSE_1_ALT} ${error.RESPONSE_2_ALT} requesting CICSRegion.`;
} else if (error instanceof imperative.RestClientError) {
errorMessage = this.formatRestClientError(error);
Expand Down

0 comments on commit ac10a1a

Please sign in to comment.