feat(desktop): surface local server startup failures (#30822)

This commit is contained in:
Luke Parker 2026-06-05 08:45:48 +10:00 committed by GitHub
commit b1a7ee5695
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 175 additions and 5 deletions

View file

@ -467,6 +467,7 @@ export const dict = {
"error.page.title": "Something went wrong",
"error.page.description": "An error occurred while loading the application.",
"error.page.description.localServerStartup": "An error occurred while starting the local server.",
"error.page.details.label": "Error Details",
"error.page.action.restart": "Restart",
"error.page.action.report": "Report Error",

View file

@ -0,0 +1,17 @@
import { describe, expect, test } from "bun:test"
import { errorDescriptionKey } from "./error-description"
describe("error description", () => {
test("describes local server startup errors", () => {
expect(errorDescriptionKey(Object.assign(new Error("migration failed"), { localServerStartup: true }))).toBe(
"error.page.description.localServerStartup",
)
})
test("uses the generic description for other errors", () => {
expect(errorDescriptionKey(new Error("unknown"))).toBe("error.page.description")
expect(errorDescriptionKey(Object.assign(new Error("unknown"), { localServerStartup: false }))).toBe(
"error.page.description",
)
})
})

View file

@ -0,0 +1,11 @@
export function errorDescriptionKey(error: unknown) {
if (
typeof error === "object" &&
error !== null &&
"localServerStartup" in error &&
error.localServerStartup === true
) {
return "error.page.description.localServerStartup" as const
}
return "error.page.description" as const
}

View file

@ -7,6 +7,7 @@ import { createStore } from "solid-js/store"
import { usePlatform } from "@/context/platform"
import { useLanguage } from "@/context/language"
import { Icon } from "@opencode-ai/ui/icon"
import { errorDescriptionKey } from "./error-description"
export type InitError = {
name: string
@ -289,7 +290,7 @@ export const ErrorPage: Component<ErrorPageProps> = (props) => {
<Logo class="w-58.5 opacity-12 shrink-0" />
<div class="flex flex-col items-center gap-2 text-center">
<h1 class="text-lg font-medium text-text-strong">{language.t("error.page.title")}</h1>
<p class="text-sm text-text-weak">{language.t("error.page.description")}</p>
<p class="text-sm text-text-weak">{language.t(errorDescriptionKey(props.error))}</p>
</div>
<TextField
value={formattedError()}