Skip to content

Commit

Permalink
Some more cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: EKhan <[email protected]>
  • Loading branch information
enamkhan committed Feb 13, 2025
1 parent 901475b commit 22fb9a1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/vsce/src/trees/CICSTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { openConfigFile } from "../utils/workspaceUtils";
import { CICSPlexTree } from "./CICSPlexTree";
import { CICSRegionTree } from "./CICSRegionTree";
import { CICSSessionTree } from "./CICSSessionTree";
import { getErrorCode } from "../utils/errorUtils";

export class CICSTree implements TreeDataProvider<CICSSessionTree> {
loadedProfiles: CICSSessionTree[] = [];
Expand Down Expand Up @@ -236,14 +237,8 @@ export class CICSTree implements TreeDataProvider<CICSSessionTree> {
plexInfo = await ProfileManagement.getPlexInfo(profile, sessionTree.getSession());
break;
} catch (error) {
if (
retry === 0 &&
(
error?.mDetails?.errorCode === constants.HTTP_ERROR_UNAUTHORIZED ||
error?.response?.status == constants.HTTP_ERROR_UNAUTHORIZED
)
) {
retry = retry + 1;
if (retry === 0 && getErrorCode(error) === constants.HTTP_ERROR_UNAUTHORIZED) {
retry++;
const newProfile = await updateProfile(profile, sessionTree);

if (!newProfile) {
Expand Down
14 changes: 14 additions & 0 deletions packages/vsce/src/utils/errorUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

export function getErrorCode(error: any) {
return error.mDetails?.errorCode || error.response?.status;
}

0 comments on commit 22fb9a1

Please sign in to comment.