Skip to content

Commit 82a3dc9

Browse files
committed
chore: refactor and print console.error on error
1 parent 802bd3b commit 82a3dc9

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

client/src/components/ContentNavigator/ContentDataProvider.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ import {
6060
isContainer as getIsContainer,
6161
} from "./utils";
6262

63+
const SAS_FILE_SEPARATOR = "~fs~";
64+
6365
class ContentDataProvider
6466
implements
6567
TreeDataProvider<ContentItem>,
@@ -684,7 +686,7 @@ class ContentDataProvider
684686
newUri,
685687
);
686688
if (newFileUri) {
687-
commands.executeCommand("vscode.open", newFileUri);
689+
await commands.executeCommand("vscode.open", newFileUri);
688690
}
689691
}
690692
}
@@ -733,10 +735,12 @@ class ContentDataProvider
733735
);
734736
try {
735737
return decodeURIComponent(uriWithoutPrefix);
736-
} catch {
738+
} catch (error) {
739+
console.error("Failed to decode URI component:", error);
737740
return uriWithoutPrefix;
738741
}
739-
} catch {
742+
} catch (error) {
743+
console.error("Failed to extract path from URI:", error);
740744
return "";
741745
}
742746
};
@@ -748,7 +752,7 @@ class ContentDataProvider
748752
if (
749753
oldBasePath &&
750754
closedFilePath &&
751-
closedFilePath.startsWith(oldBasePath + "~fs~")
755+
closedFilePath.startsWith(oldBasePath + SAS_FILE_SEPARATOR)
752756
) {
753757
try {
754758
const relativePath = closedFilePath.substring(oldBasePath.length);
@@ -767,9 +771,10 @@ class ContentDataProvider
767771
);
768772

769773
return Uri.parse(
770-
`sasServer:/${filename}?${encodeURIComponent(newQuery)}`,
774+
`${newItemUri.scheme}:/${filename}?${encodeURIComponent(newQuery)}`,
771775
);
772-
} catch {
776+
} catch (error) {
777+
console.error("Failed to construct new file URI:", error);
773778
return null;
774779
}
775780
}

0 commit comments

Comments
 (0)