mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 05:01:03 +03:00
fix: show API error messages in remaining CLI and TUI paths (#50783)
This commit is contained in:
committed by
GitHub
Unverified
parent
2e4abeb25d
commit
740072694d
@@ -3,6 +3,7 @@ import { useClient } from "../context/client"
|
||||
import { useTheme } from "../context/theme"
|
||||
import { SplitBorder } from "../ui/border"
|
||||
import { useToast } from "../ui/toast"
|
||||
import { errorMessage } from "../util/error"
|
||||
import { Spinner } from "./spinner"
|
||||
|
||||
type Progress = { label: string; numerator?: number; denominator?: number }
|
||||
@@ -30,7 +31,7 @@ export function MigrationOverlay() {
|
||||
toast.show({
|
||||
variant: "error",
|
||||
title: "Data migration failed",
|
||||
message: error instanceof Error ? error.message : String(error),
|
||||
message: errorMessage(error),
|
||||
duration: 10_000,
|
||||
})
|
||||
})
|
||||
|
||||
@@ -7,6 +7,7 @@ import { Spinner } from "../../component/spinner"
|
||||
import { usePlugin } from "../../plugin/context"
|
||||
import { DialogSelect, type DialogSelectOption } from "../../ui/dialog-select"
|
||||
import { useDialog } from "../../ui/dialog"
|
||||
import { errorMessage } from "../../util/error"
|
||||
|
||||
const id = "opencode.plugins"
|
||||
|
||||
@@ -134,7 +135,7 @@ export function PluginsDialog(props: {
|
||||
.catch((cause) => {
|
||||
props.context.ui.toast.show({
|
||||
variant: "error",
|
||||
message: cause instanceof Error ? cause.message : String(cause),
|
||||
message: errorMessage(cause),
|
||||
})
|
||||
})
|
||||
.finally(() => setLocked(false))
|
||||
@@ -152,7 +153,7 @@ export function PluginsDialog(props: {
|
||||
.catch((cause) => {
|
||||
props.context.ui.toast.show({
|
||||
variant: "error",
|
||||
message: cause instanceof Error ? cause.message : String(cause),
|
||||
message: errorMessage(cause),
|
||||
})
|
||||
})
|
||||
.finally(() => setPending((keys) => keys.filter((key) => key !== entry.key)))
|
||||
@@ -173,7 +174,7 @@ export function PluginsDialog(props: {
|
||||
.catch((cause) => {
|
||||
props.context.ui.toast.show({
|
||||
variant: "error",
|
||||
message: cause instanceof Error ? cause.message : String(cause),
|
||||
message: errorMessage(cause),
|
||||
})
|
||||
})
|
||||
.finally(() => setChecking(false))
|
||||
|
||||
@@ -12,6 +12,7 @@ import { SessionMessage } from "@opencode/schema/session-message"
|
||||
import type { LocationRef } from "@opencode/client/promise"
|
||||
import type { Config } from "../config"
|
||||
import { newSessionLocation } from "../config/new-session-location"
|
||||
import { errorMessage } from "../util/error"
|
||||
import { loadRunAgents, loadRunCommands, loadRunReferences } from "./catalog.shared"
|
||||
import {
|
||||
resolveMiniSettings,
|
||||
@@ -863,7 +864,7 @@ async function runInteractiveRuntime(input: RunRuntimeInput, deps: RunRuntimeDep
|
||||
if (signal?.aborted || footer.isClosed) return
|
||||
const text =
|
||||
(await state.stream?.then((item) => item.mod).catch(() => undefined))?.formatUnknownError(error) ??
|
||||
(error instanceof Error ? error.message : String(error))
|
||||
errorMessage(error)
|
||||
const commit = {
|
||||
kind: "error",
|
||||
text,
|
||||
@@ -1007,7 +1008,7 @@ async function runInteractiveRuntime(input: RunRuntimeInput, deps: RunRuntimeDep
|
||||
})
|
||||
const commit = {
|
||||
kind: "error",
|
||||
text: error instanceof Error ? error.message : String(error),
|
||||
text: errorMessage(error),
|
||||
phase: "start",
|
||||
source: "system",
|
||||
messageID: SessionMessage.ID.create(),
|
||||
|
||||
Reference in New Issue
Block a user