Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Navigate to `LoadError` when node view isn't able to load
Sebastian Martinez committed 2 years ago
commit b12a9495cbe800be9b05a9f0a352d33a99bc70e8
parent 288f55da7667d0678d4c1abc248da2cff54891e4
1 file changed +13 -3
modified src/views/nodes/router.ts
@@ -1,5 +1,8 @@
import type { BaseUrl, CommitHeader, Project } from "@httpd-client";
-
import type { NotFoundRoute } from "@app/lib/router/definitions";
+
import type {
+
  LoadErrorRoute,
+
  NotFoundRoute,
+
} from "@app/lib/router/definitions";
import type { WeeklyActivity } from "@app/lib/commit";

import { HttpdClient } from "@httpd-client";
@@ -89,7 +92,7 @@ export function nodePath(baseUrl: BaseUrl) {

export async function loadNodeRoute(
  params: NodesRouteParams,
-
): Promise<NodesLoadedRoute | NotFoundRoute> {
+
): Promise<NodesLoadedRoute | NotFoundRoute | LoadErrorRoute> {
  const api = new HttpdClient(params.baseUrl);
  try {
    const projectPageIndex = 0;
@@ -117,7 +120,14 @@ export async function loadNodeRoute(
        },
      };
    } else {
-
      throw error;
+
      return {
+
        resource: "loadError",
+
        params: {
+
          title: "Not able to load this node",
+
          errorMessage: error.message,
+
          stackTrace: error.stackTrace,
+
        },
+
      };
    }
  }
}