#2517 improve tRPC error handling #2520
Merged
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.
TRPCError
object, which can then be correctly serialized, detected, and handled on the webview side.There is a follow-up work item lined up: #2521
Error Handling Improvements:
src/webviews/api/configuration/appRouter.ts
: Added a newdisplayErrorMessage
procedure to show error messages in VS Code.src/webviews/api/extension-server/WebviewController.ts
: Introduced awrapInTrpcErrorMessage
method to format errors for TRPC.src/webviews/mongoClusters/collectionView/CollectionView.tsx
: Replaced console error logging with calls to the newdisplayErrorMessage
procedure. [1] [2] [3] [4] [5] [6]Telemetry Enhancements:
src/webviews/api/extension-server/trpc.ts
: Enhanced telemetry properties to include detailed error information such as name, message, stack, and cause.Minor Improvements:
src/webviews/api/webview-client/vscodeLink.ts
: Updated theVsCodeLinkResponseMessage
interface to include additional error properties.