Skip to content

Commit 49035b2

Browse files
Scott DoverScott Dover
authored andcommitted
chore: add new error message
Signed-off-by: Scott Dover <Scott.Dover@sas.com>
1 parent 70c039a commit 49035b2

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

client/src/components/ContentNavigator/const.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ export const Messages = {
7474
FileDragFromFavorites: l10n.t("Unable to drag files from my favorites."),
7575
FileDragFromTrashError: l10n.t("Unable to drag files from trash."),
7676
FileDropError: l10n.t('Unable to drop item "{name}".'),
77-
FileNavigationRootError: l10n.t(
77+
FileNavigationRootAdminError: l10n.t(
78+
"The files cannot be accessed from the specified path. Contact your system administrator.",
79+
),
80+
FileNavigationRootUserError: l10n.t(
7881
"The files cannot be accessed from the specified path.",
7982
),
8083
FileOpenError: l10n.t("The file type is unsupported."),

client/src/connection/itc/ItcServerAdapter.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
3-
import { FileType, Uri, l10n, workspace } from "vscode";
3+
import { FileType, Uri, workspace } from "vscode";
44

55
import { v4 } from "uuid";
66

@@ -162,11 +162,7 @@ class ItcServerAdapter implements ContentAdapter {
162162
);
163163
if (!success) {
164164
if (this.fileNavigationRoot === "CUSTOM") {
165-
throw new Error(
166-
l10n.t(Messages.FileNavigationRootError, {
167-
path: this.fileNavigationCustomRootPath,
168-
}),
169-
);
165+
throw new Error(Messages.FileNavigationRootUserError);
170166
}
171167
return [];
172168
}

client/src/connection/rest/RestServerAdapter.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright © 2024, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
3-
import { FileType, Uri, l10n } from "vscode";
3+
import { FileType, Uri } from "vscode";
44

55
import { AxiosResponse } from "axios";
66

@@ -48,13 +48,15 @@ class RestServerAdapter implements ContentAdapter {
4848
private fileMetadataMap: {
4949
[id: string]: { etag: string; lastModified?: string; contentType?: string };
5050
};
51+
private fileNavigationSetByAdmin: boolean;
5152

5253
public constructor(
5354
protected fileNavigationCustomRootPath: ProfileWithFileRootOptions["fileNavigationCustomRootPath"],
5455
protected fileNavigationRoot: ProfileWithFileRootOptions["fileNavigationRoot"],
5556
) {
5657
this.rootFolders = {};
5758
this.fileMetadataMap = {};
59+
this.fileNavigationSetByAdmin = false;
5860
}
5961

6062
addChildItem: (
@@ -75,9 +77,11 @@ class RestServerAdapter implements ContentAdapter {
7577
if (session.contextAttributes) {
7678
const attributes = await session.contextAttributes();
7779
if (
78-
attributes.fileNavigationCustomRootPath ||
79-
attributes.fileNavigationRoot
80+
attributes &&
81+
(attributes.fileNavigationCustomRootPath ||
82+
attributes.fileNavigationRoot)
8083
) {
84+
this.fileNavigationSetByAdmin = true;
8185
this.fileNavigationCustomRootPath =
8286
attributes.fileNavigationCustomRootPath ?? "";
8387
this.fileNavigationRoot = attributes.fileNavigationRoot ?? "USER";
@@ -260,11 +264,11 @@ class RestServerAdapter implements ContentAdapter {
260264
parentItem.uri === SAS_SERVER_HOME_DIRECTORY &&
261265
this.fileNavigationRoot === "CUSTOM"
262266
) {
263-
throw new Error(
264-
l10n.t(Messages.FileNavigationRootError, {
265-
path: this.fileNavigationCustomRootPath,
266-
}),
267-
);
267+
if (this.fileNavigationSetByAdmin) {
268+
throw new Error(Messages.FileNavigationRootAdminError);
269+
} else {
270+
throw new Error(Messages.FileNavigationRootUserError);
271+
}
268272
}
269273
throw error;
270274
}

0 commit comments

Comments
 (0)