MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / sendMappedError

Function sendMappedError

packages/server/src/routes/tools.ts:166–176  ·  view source on GitHub ↗

* Map a thrown error to the right envelope. See module header for the table.

(
  reply: { send(payload: unknown): unknown },
  requestId: string,
  err: unknown,
)

Source from the content-addressed store, hash-verified

164 * Map a thrown error to the right envelope. See module header for the table.
165 */
166function sendMappedError(
167 reply: { send(payload: unknown): unknown },
168 requestId: string,
169 err: unknown,
170): void {
171 if (err instanceof McpServerNotFoundError) {
172 reply.send(errEnvelope(ErrorCode.MCP_SERVER_NOT_FOUND, err.message, requestId));
173 return;
174 }
175 throw err;
176}

Callers 1

registerToolsRoutesFunction · 0.70

Calls 2

errEnvelopeFunction · 0.90
sendMethod · 0.65

Tested by

no test coverage detected