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.
This pull request enhances error handling and messaging across the exceptions and SDK packages, particularly for gRPC and chain transaction errors. The main improvements include better extraction and mapping of error codes and modules from gRPC messages, introduction of new error codes, and more user-friendly error messages.
Error handling improvements:
BaseGrpcConsumer.ts: Added methods to extract ABCI error codes and codespace modules from gRPC error messages, and updated the centralized error handler to throw aTransactionExceptionwith detailed context when chain error details are present. This enables more accurate and user-friendly error reporting for chain-related errors.base.ts,maps.ts: Updated the error context structure and parsing logic to support a newcontextCodefield, ensuring that ABCI codes are correctly propagated and mapped throughout the error handling pipeline. [1] [2]Error code and message mapping:
codes.ts: Introduced new error codesErrInvalidClosingDirectionandErrInvalidNotionalfor the chain exchange module, enabling more granular error identification.messages.ts: Mapped the newErrInvalidClosingDirectionerror code to a descriptive message, improving clarity for end users.User-facing error messages:
maps.ts: Enhanced the error message mapping logic to useparseErrorMessagefor fallback messages, ensuring that users receive clearer and more informative error descriptions when specific mappings are unavailable.These changes collectively improve the robustness and clarity of error handling, especially for transaction failures and gRPC communication issues.