fix(errors): forward SdkError causes onto Error.cause - #2666
Conversation
classifyNetworkError (and any site that passes `{ cause }` as the data
argument) left the underlying fetch/DNS error in `.data.cause`, so pino
and Sentry cause-chain walkers stopped at the SdkError and lost
ENOTFOUND vs ECONNREFUSED detail.
Peel a `cause` key out of the data bag into ErrorOptions, accept an
explicit options argument, and construct the negotiation failure with
`{ cause }` on ErrorOptions. Adds focused regression tests.
|
@modelcontextprotocol/client
@modelcontextprotocol/codemod
@modelcontextprotocol/core
@modelcontextprotocol/server
@modelcontextprotocol/server-legacy
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
|
Happy to adjust the peel heuristics if you'd rather keep |
|
Thank you for this PR. Closing in favour of #2726 |
Summary
SdkError third argument is
data, but classifyNetworkError passed{ cause }. That left the underlying fetch/DNS error on.data.causeinstead of.cause, so pino/Sentry cause-chain walkers lost ENOTFOUND vs ECONNREFUSED detail.{ cause }out of the data bag into ErrorOptionsoptions?: ErrorOptionson SdkError / SdkHttpError{ cause }Closes #2657
Test plan