diff options
Diffstat (limited to 'packages/app/src/context')
| -rw-r--r-- | packages/app/src/context/global-sync.tsx | 9 | ||||
| -rw-r--r-- | packages/app/src/context/global-sync/bootstrap.ts | 8 |
2 files changed, 9 insertions, 8 deletions
diff --git a/packages/app/src/context/global-sync.tsx b/packages/app/src/context/global-sync.tsx index 7e242130f..9fbc93bde 100644 --- a/packages/app/src/context/global-sync.tsx +++ b/packages/app/src/context/global-sync.tsx @@ -36,6 +36,7 @@ import type { ProjectMeta } from "./global-sync/types" import { SESSION_RECENT_LIMIT } from "./global-sync/types" import { sanitizeProject } from "./global-sync/utils" import { usePlatform } from "./platform" +import { formatServerError } from "@/utils/server-errors" type GlobalStore = { ready: boolean @@ -51,11 +52,6 @@ type GlobalStore = { reload: undefined | "pending" | "complete" } -function errorMessage(error: unknown) { - if (error instanceof Error && error.message) return error.message - if (typeof error === "string" && error) return error - return "Unknown error" -} function createGlobalSync() { const globalSDK = useGlobalSDK() @@ -207,8 +203,9 @@ function createGlobalSync() { console.error("Failed to load sessions", err) const project = getFilename(directory) showToast({ + variant: "error", title: language.t("toast.session.listFailed.title", { project }), - description: errorMessage(err), + description: formatServerError(err), }) }) diff --git a/packages/app/src/context/global-sync/bootstrap.ts b/packages/app/src/context/global-sync/bootstrap.ts index 6e7714828..b35f1cd80 100644 --- a/packages/app/src/context/global-sync/bootstrap.ts +++ b/packages/app/src/context/global-sync/bootstrap.ts @@ -16,6 +16,7 @@ import { batch } from "solid-js" import { reconcile, type SetStoreFunction, type Store } from "solid-js/store" import type { State, VcsCache } from "./types" import { cmp, normalizeProviderList } from "./utils" +import { formatServerError } from "@/utils/server-errors" type GlobalStore = { ready: boolean @@ -133,8 +134,11 @@ export async function bootstrapDirectory(input: { } catch (err) { console.error("Failed to bootstrap instance", err) const project = getFilename(input.directory) - const message = err instanceof Error ? err.message : String(err) - showToast({ title: `Failed to reload ${project}`, description: message }) + showToast({ + variant: "error", + title: `Failed to reload ${project}`, + description: formatServerError(err) + }) input.setStore("status", "partial") return } |
