Include error code and message in the 'Sending response' trace log - #1854
Merged
Dirk Bäumer (dbaeumer) merged 2 commits intoSep 22, 2026
Merged
Conversation
Motivation: When a server sends back a JSON-RPC error response, the 'Sending response' trace line only surfaced error.data (when present) but silently dropped error.code and error.message. A user debugging a malformed request spent significant time investigating because the trace output gave no indication that an error had even occurred, even though the underlying response clearly carried a -32602 error with a descriptive message. Approach: traceReceivedResponse (the client-side counterpart in the same file) already appends "Request failed: <message> (<code>)." to its main log line when message.error is set. Apply the identical pattern to traceSendingResponse so the server-side trace line carries the same information. This is a pure logging/string-formatting change with no behavioral or API impact. Validation: - `npx tsc -b ./jsonrpc/tsconfig.json` and `npx tsc -b tsconfig.json` (full monorepo) both compile cleanly. - `npm run lint` (eslint) in jsonrpc/ passes with no new warnings. - Added a test, "Trace includes error code and message when sending an error response", to jsonrpc/src/node/test/connection.test.ts. Ran `npm run test:node` in jsonrpc/: 68 passing, including the new test. Verified the test fails (times out, since the assertion runs inside a rejection-handler `.then()` callback, consistent with this file's existing test style) against the pre-fix code and passes against the fix. - Did not run the jsonrpc browser test suite (npm run test:browser) in this environment: it requires downloading a Playwright Chrome binary, which failed here due to local disk space constraints. The browser tests exercise the same shared jsonrpc/src/common/connection.ts trace code path, so this is a disclosed gap rather than a skipped check. Report: microsoft#1604 Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com> Assisted-by: claude-sonnet-5 (via Claude Code)
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟢 Approval recommended
The focused logging change is tested, with only minor punctuation cleanup outstanding.
Pull request overview
Adds JSON-RPC error details to server-side response traces for easier debugging.
Changes:
- Logs error messages and codes when sending failed responses.
- Adds regression coverage for error-response tracing.
File summaries
| File | Description |
|---|---|
jsonrpc/src/node/test/connection.test.ts |
Tests error details in response traces. |
jsonrpc/src/common/connection.ts |
Appends error messages and codes to traces. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Matches the existing traceReceivedResponse format so the trace line reads as a proper sentence boundary, per Copilot review feedback. Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Contributor
Author
|
Good catch, added the missing period so it now reads |
Member
|
/AzurePipelines run |
Dirk Bäumer (dbaeumer)
approved these changes
Sep 21, 2026
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Contributor
Author
|
This is approved with green CI and no outstanding comments as far as I can tell — ready whenever you have a moment. Happy to rebase first if you'd like it freshened. |
Sandeep Somavarapu (sandy081)
approved these changes
Sep 21, 2026
Nick Trogh (ntrogh)
approved these changes
Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Motivation:
When a server sends back a JSON-RPC error response, the
'Sending response' trace line only surfaced error.data (when
present) but silently dropped error.code and error.message. A user
debugging a malformed request spent significant time investigating
because the trace output gave no indication that an error had even
occurred, even though the underlying response clearly carried a
-32602 error with a descriptive message.
Approach:
traceReceivedResponse (the client-side counterpart in the same file)
already appends "Request failed: (
)." to its mainlog line when message.error is set. Apply the identical pattern to
traceSendingResponse so the server-side trace line carries the same
information. This is a pure logging/string-formatting change with no
behavioral or API impact.
Validation:
npx tsc -b ./jsonrpc/tsconfig.jsonandnpx tsc -b tsconfig.json(full monorepo) both compile cleanly.
npm run lint(eslint) in jsonrpc/ passes with no new warnings.an error response", to jsonrpc/src/node/test/connection.test.ts.
Ran
npm run test:nodein jsonrpc/: 68 passing, including the newtest. Verified the test fails (times out, since the assertion runs
inside a rejection-handler
.then()callback, consistent with thisfile's existing test style) against the pre-fix code and passes
against the fix.
in this environment: it requires downloading a Playwright Chrome
binary, which failed here due to local disk space constraints. The
browser tests exercise the same shared
jsonrpc/src/common/connection.ts trace code path, so this is a
disclosed gap rather than a skipped check.
Report: #1604
Signed-off-by: Pujitha Paladugu 10557236+pujitha24@users.noreply.github.com
Assisted-by: claude-sonnet-5 (via Claude Code)
Fixes #1604