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

Function extractServerMessage

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

Source from the content-addressed store, hash-verified

126}
127
128function extractServerMessage(data: unknown): string | undefined {
129 if (typeof data === 'string') {
130 return data
131 }
132 if (data && typeof data === 'object') {
133 const obj = data as Record<string, unknown>
134 if (typeof obj.message === 'string') {
135 return obj.message
136 }
137 if (
138 typeof obj.error === 'object' &&
139 obj.error &&
140 'message' in obj.error &&
141 typeof (obj.error as Record<string, unknown>).message === 'string'
142 ) {
143 return (obj.error as Record<string, unknown>).message as string
144 }
145 }
146 return undefined
147}
148
149/**
150 * 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