A non-2xx POST is synthesized into a JSON-RPC error whose code cannot express
the retry decision: a terminal 401 and a transient 503 both arrive as
INTERNAL_ERROR with the same "Server returned an error response" message. A
caller cannot tell "my token is bad, stop" from "the server hiccuped, retry".
The status now rides along on `error.data` as `{"httpStatus": 503}`. `data` is
free-form per the JSON-RPC spec, so this is additive: nothing that reads `code`
or `message` changes.
An error the server supplied in its body keeps its own `data` untouched — its
account of the failure outranks ours. A non-2xx to a notification has no waiter
to resolve, so it is logged rather than dropped silently.
Requested on modelcontextprotocol#3091 by the reporter, who needs the distinction for retry
classification in a downstream client.
A non-2xx POST is synthesized into a JSON-RPC error whose code cannot express the retry decision: a terminal 401 and a transient 503 both arrive as INTERNAL_ERROR with the same "Server returned an error response" message. A caller cannot tell "my token is bad, stop" from "the server hiccuped, retry".
The status now rides along on error.data as {"httpStatus": 503}. data is free-form per the JSON-RPC spec, so this is additive: nothing that reads code or message changes.
An error the server supplied in its body keeps its own data untouched — its account of the failure outranks ours. A non-2xx to a notification has no waiter to resolve, so it is logged rather than dropped silently.
Requested on #3091 by the reporter, who needs the distinction for retry classification in a downstream client.
Motivation and Context
How Has This Been Tested?
Breaking Changes
Types of changes
Checklist
Additional context