Preserve JSON-RPC error data in .NET#1425
Open
stephentoub wants to merge 1 commit into
Open
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the .NET JSON-RPC transport to retain the JSON-RPC error.data payload from error responses by storing it on the internal RemoteRpcException, while leaving the existing public-facing exception behavior (wrapping into IOException) unchanged.
Changes:
- Parse and capture
error.datafrom JSON-RPC error responses in the response handler. - Extend
RemoteRpcExceptionto carry anErrorDataJsonElement?payload. - Attach the captured error data when completing pending RPC requests with an exception.
Show a summary per file
| File | Description |
|---|---|
| dotnet/src/JsonRpc.cs | Captures error.data from JSON-RPC responses and stores it on RemoteRpcException for internal propagation. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 2
| : 0; | ||
| pending.TrySetException(new RemoteRpcException(errorMessage, errorCode)); | ||
| var errorData = errorProp.TryGetProperty("data", out var dataProp) | ||
| ? dataProp.Clone() |
Comment on lines
+443
to
+446
| var errorData = errorProp.TryGetProperty("data", out var dataProp) | ||
| ? dataProp.Clone() | ||
| : (JsonElement?)null; | ||
| pending.TrySetException(new RemoteRpcException(errorMessage, errorCode, errorData)); |
Contributor
Cross-SDK Consistency Review ✅This PR improves cross-SDK consistency by adding
All four SDKs now preserve
|
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.
Summary
error.datain the .NET client transport by carrying it on the internal remote RPC exception.Validation
dotnet build .\src\GitHub.Copilot.SDK.csproj --no-restore -f net8.0 /m:1 /nodeReuse:false