MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / extractServerMessage

Function extractServerMessage

source code/utils/errorLogSink.ts:130–149  ·  view source on GitHub ↗
(data: unknown)

Source from the content-addressed store, hash-verified

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