summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/context/global-sync/bootstrap.ts
diff options
context:
space:
mode:
authorOpeOginni <[email protected]>2026-03-05 13:28:17 +0100
committerGitHub <[email protected]>2026-03-05 06:28:17 -0600
commit27baa2d65cfa100283bda334e80244d6d8c440fb (patch)
treedb897fd42063652865ab28ad788412c557fc7eff /packages/app/src/context/global-sync/bootstrap.ts
parent62909e917ada44f64bf46fb38936bc99357cb63c (diff)
downloadopencode-27baa2d65cfa100283bda334e80244d6d8c440fb.tar.gz
opencode-27baa2d65cfa100283bda334e80244d6d8c440fb.zip
refactor(desktop): improve error handling and translation in server error formatting (#16171)
Diffstat (limited to 'packages/app/src/context/global-sync/bootstrap.ts')
-rw-r--r--packages/app/src/context/global-sync/bootstrap.ts16
1 files changed, 4 insertions, 12 deletions
diff --git a/packages/app/src/context/global-sync/bootstrap.ts b/packages/app/src/context/global-sync/bootstrap.ts
index bc84eb169..8b1a3c48c 100644
--- a/packages/app/src/context/global-sync/bootstrap.ts
+++ b/packages/app/src/context/global-sync/bootstrap.ts
@@ -36,8 +36,7 @@ export async function bootstrapGlobal(input: {
connectErrorTitle: string
connectErrorDescription: string
requestFailedTitle: string
- unknownError: string
- invalidConfigurationError: string
+ translate: (key: string, vars?: Record<string, string | number>) => string
formatMoreCount: (count: number) => string
setGlobalStore: SetStoreFunction<GlobalStore>
}) {
@@ -91,10 +90,7 @@ export async function bootstrapGlobal(input: {
const results = await Promise.allSettled(tasks)
const errors = results.filter((r): r is PromiseRejectedResult => r.status === "rejected").map((r) => r.reason)
if (errors.length) {
- const message = formatServerError(errors[0], {
- unknown: input.unknownError,
- invalidConfiguration: input.invalidConfigurationError,
- })
+ const message = formatServerError(errors[0], input.translate)
const more = errors.length > 1 ? input.formatMoreCount(errors.length - 1) : ""
showToast({
variant: "error",
@@ -122,8 +118,7 @@ export async function bootstrapDirectory(input: {
setStore: SetStoreFunction<State>
vcsCache: VcsCache
loadSessions: (directory: string) => Promise<void> | void
- unknownError: string
- invalidConfigurationError: string
+ translate: (key: string, vars?: Record<string, string | number>) => string
}) {
if (input.store.status !== "complete") input.setStore("status", "loading")
@@ -145,10 +140,7 @@ export async function bootstrapDirectory(input: {
showToast({
variant: "error",
title: `Failed to reload ${project}`,
- description: formatServerError(err, {
- unknown: input.unknownError,
- invalidConfiguration: input.invalidConfigurationError,
- }),
+ description: formatServerError(err, input.translate),
})
input.setStore("status", "partial")
return