MCPcopy Index your code
hub / github.com/anomalyco/opencode / formatError

Function formatError

packages/opencode/src/cli/cmd/run/session-data.ts:163–183  ·  view source on GitHub ↗
(error: {
  name?: string
  message?: string
  data?: {
    message?: string
  }
})

Source from the content-addressed store, hash-verified

161}
162
163export function formatError(error: {
164 name?: string
165 message?: string
166 data?: {
167 message?: string
168 }
169}): string {
170 if (error.data?.message) {
171 return error.data.message
172 }
173
174 if (error.message) {
175 return error.message
176 }
177
178 if (error.name) {
179 return error.name
180 }
181
182 return "unknown error"
183}
184
185function isAbort(error: { name?: string } | undefined): boolean {
186 return error?.name === "MessageAbortedError"

Callers 2

reduceSubagentDataFunction · 0.90
reduceSessionDataFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected