MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / summarizeSdkFailure

Function summarizeSdkFailure

packages/plugins/mcp/src/sdk/invoke.ts:161–166  ·  view source on GitHub ↗
(cause: unknown)

Source from the content-addressed store, hash-verified

159/** The class name and stable code of an SDK rejection, for the defect log.
160 * Structural only: the message is deliberately not read here. */
161const summarizeSdkFailure = (cause: unknown): { name: string; code?: string | number } => {
162 // oxlint-disable-next-line executor/no-instanceof-error -- boundary: the MCP SDK rejects with Error subclasses whose constructor name is the only class discriminator for non-branded errors
163 const name = cause instanceof Error ? cause.constructor.name : typeof cause;
164 const code = Predicate.hasProperty(cause, "code") ? cause.code : undefined;
165 return typeof code === "string" || typeof code === "number" ? { name, code } : { name };
166};
167
168/** A 4xx other than the auth walls, with a JSON body that names the problem,
169 * is the server refusing THIS call (a validation failure at the HTTP layer)

Callers 1

useConnectionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected