Skip to content

Commit 22fb9a1

Browse files
committed
Some more cleanup
Signed-off-by: EKhan <[email protected]>
1 parent 901475b commit 22fb9a1

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

packages/vsce/src/trees/CICSTree.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { openConfigFile } from "../utils/workspaceUtils";
3434
import { CICSPlexTree } from "./CICSPlexTree";
3535
import { CICSRegionTree } from "./CICSRegionTree";
3636
import { CICSSessionTree } from "./CICSSessionTree";
37+
import { getErrorCode } from "../utils/errorUtils";
3738

3839
export class CICSTree implements TreeDataProvider<CICSSessionTree> {
3940
loadedProfiles: CICSSessionTree[] = [];
@@ -236,14 +237,8 @@ export class CICSTree implements TreeDataProvider<CICSSessionTree> {
236237
plexInfo = await ProfileManagement.getPlexInfo(profile, sessionTree.getSession());
237238
break;
238239
} catch (error) {
239-
if (
240-
retry === 0 &&
241-
(
242-
error?.mDetails?.errorCode === constants.HTTP_ERROR_UNAUTHORIZED ||
243-
error?.response?.status == constants.HTTP_ERROR_UNAUTHORIZED
244-
)
245-
) {
246-
retry = retry + 1;
240+
if (retry === 0 && getErrorCode(error) === constants.HTTP_ERROR_UNAUTHORIZED) {
241+
retry++;
247242
const newProfile = await updateProfile(profile, sessionTree);
248243

249244
if (!newProfile) {

packages/vsce/src/utils/errorUtils.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* This program and the accompanying materials are made available under the terms of the
3+
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
4+
* https://www.eclipse.org/legal/epl-v20.html
5+
*
6+
* SPDX-License-Identifier: EPL-2.0
7+
*
8+
* Copyright Contributors to the Zowe Project.
9+
*
10+
*/
11+
12+
export function getErrorCode(error: any) {
13+
return error.mDetails?.errorCode || error.response?.status;
14+
}

0 commit comments

Comments
 (0)