Skip to content

Preserve JSON-RPC error details in string formatting - #65500

Merged
Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
jakebailey:compiler-fixes/jsonrpc-error-data
Nov 17, 2026
Merged

Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
jakebailey:compiler-fixes/jsonrpc-error-data

Conversation

@jakebailey

Copy link
Copy Markdown
Member

This code was accidentally flipped around.

Successful data marshaling was treated as a failure, dropping useful
details while unsupported values rendered an empty byte slice.

Include successfully encoded details as JSON text and retain the basic
code/message form when data is absent or cannot be marshaled. Cover the
formatting and Error delegation in the existing protocol tests.
Copilot AI balanced review requested due to automatic review settings November 14, 2026 04:20
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Nov 14, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Nov 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the JSON-RPC error-formatting change.

No open issues 🎉

What changed in this PR

Fixes the shared JSON-RPC error formatter so successfully serialized error details appear as readable JSON in error strings.

Changes:

  • Corrects the success check and formats serialized data as text rather than byte values.
  • Adds regression tests for JSON details, nil receivers, nil data, and unmarshalable data through both String() and Error().
File Description
tsc/​internal/​lsp/​lsproto/​jsonrpc_test.go Adds error-formatting regression tests.
tsc/​internal/​jsonrpc/​jsonrpc.go Includes JSON details when serialization succeeds and data is non-nil.

Review effort: Balanced

@github-project-automation github-project-automation Bot moved this from Not started to Needs merge in PR Backlog Nov 17, 2026
@jakebailey
Jake Bailey (jakebailey) added this pull request to the merge queue Nov 17, 2026
Merged via the queue into microsoft:main with commit be7b4fe Nov 17, 2026
34 checks passed
@jakebailey
Jake Bailey (jakebailey) deleted the compiler-fixes/jsonrpc-error-data branch November 17, 2026 20:27
@github-project-automation github-project-automation Bot moved this from Needs merge to Done in PR Backlog Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants