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

Function errorMessage

packages/tui/src/util/error.ts:125–145  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

123}
124
125export function errorMessage(error: unknown): string {
126 if (error instanceof Error) {
127 if (error.message) return error.message
128 if (error.name) return error.name
129 }
130
131 if (isRecord(error) && typeof error.message === "string" && error.message) {
132 return error.message
133 }
134
135 if (isRecord(error) && isRecord(error.data) && typeof error.data.message === "string" && error.data.message) {
136 return error.data.message
137 }
138
139 const text = String(error)
140 if (text && text !== "[object Object]") return text
141
142 const formatted = errorFormat(error)
143 if (formatted) return formatted
144 return "unknown error"
145}
146
147export function errorData(error: unknown) {
148 if (error instanceof Error) {

Callers 15

error.test.tsFile · 0.90
warpFunction · 0.90
recoverFunction · 0.90
DialogSessionListFunction · 0.90
removeFunction · 0.90
DialogMoveSessionFunction · 0.90
loadWorkspaceAdaptersFunction · 0.90
warpWorkspaceSessionFunction · 0.90
removeFunction · 0.90
DialogConsoleOrgFunction · 0.90
DialogSkillFunction · 0.90
createFunction · 0.90

Calls 2

isRecordFunction · 0.90
errorFormatFunction · 0.85

Tested by

no test coverage detected