Move error handling for filesystem to frontend

This commit is contained in:
2026-07-30 21:31:35 +02:00
parent e88b137d2b
commit 39e0019ce3
4 changed files with 77 additions and 30 deletions

View File

@@ -54,6 +54,7 @@ export class FSNavigator {
}
last_requested_path: string = ""
navigation_error: string = ""
navigate = async (path: string, push_history: boolean) => {
if (path === this.last_requested_path) {
console.debug("FSNavigator: Requested path ", path, " is equal to current path. Debouncing")
@@ -72,14 +73,14 @@ export class FSNavigator {
const resp = await fs_get_node(path)
this.open_node(resp, push_history)
} catch (err: any) {
if (err.value && err.value === "path_not_found") {
if (err.value !== undefined && err.value === "path_not_found") {
if (path !== this.path[0].path && path !== "/" && path !== "") {
console.debug("Path", path, "was not found, trying to navigate to parent")
this.navigate(fs_split_path(path).parent, push_history)
}
} else if (err.message) {
console.error(err)
alert("Error: " + err.message)
} else if (err.value !== undefined) {
this.navigation_error = err.value
this.notify_subscribers()
} else {
console.error(err)
alert("Error: " + err)
@@ -133,6 +134,7 @@ export class FSNavigator {
this.children = node.children
this.permissions = node.permissions
this.context = node.context
this.navigation_error = "" // Clear the error value
this.initialized = true
console.debug("Opened node", node)