From b12a9495cbe800be9b05a9f0a352d33a99bc70e8 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Fri, 6 Oct 2023 14:18:48 +0200 Subject: [PATCH] Navigate to `LoadError` when node view isn't able to load This can have multiple reasons, interface has added a new property but httpds haven't updated yet. Other issues with some specific endpoints that return a 500 and we can't load it. Signed-off-by: Sebastian Martinez --- src/views/nodes/router.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/views/nodes/router.ts b/src/views/nodes/router.ts index 92f2267b6..544359d17 100644 --- a/src/views/nodes/router.ts +++ b/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 { +): Promise { 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, + }, + }; } } }