MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / extractServerMessage

Function extractServerMessage

src/utils/errorLogSink.ts:129–148  ·  view source on GitHub ↗
(data: unknown)

Source from the content-addressed store, hash-verified

127}
128
129function extractServerMessage(data: unknown): string | undefined {
130 if (typeof data === 'string') {
131 return data
132 }
133 if (data && typeof data === 'object') {
134 const obj = data as Record<string, unknown>
135 if (typeof obj.message === 'string') {
136 return obj.message
137 }
138 if (
139 typeof obj.error === 'object' &&
140 obj.error &&
141 'message' in obj.error &&
142 typeof (obj.error as Record<string, unknown>).message === 'string'
143 ) {
144 return (obj.error as Record<string, unknown>).message as string
145 }
146 }
147 return undefined
148}
149
150/**
151 * Implementation for logError - writes error to debug log and file.

Callers 1

logErrorImplFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected