diff --git a/.changeset/bright-wombats-try.md b/.changeset/bright-wombats-try.md new file mode 100644 index 0000000000000..f0a8016810e5d --- /dev/null +++ b/.changeset/bright-wombats-try.md @@ -0,0 +1,5 @@ +--- +'@mysten/sui.js': patch +--- + +Add support for more JSON RPC error codes diff --git a/sdk/typescript/src/client/errors.ts b/sdk/typescript/src/client/errors.ts index bd1e68e37e070..a13b59fd1b839 100644 --- a/sdk/typescript/src/client/errors.ts +++ b/sdk/typescript/src/client/errors.ts @@ -3,10 +3,21 @@ const CODE_TO_ERROR_TYPE: Record = { '-32700': 'ParseError', + '-32701': 'OversizedRequest', + '-32702': 'OversizedResponse', '-32600': 'InvalidRequest', '-32601': 'MethodNotFound', '-32602': 'InvalidParams', '-32603': 'InternalError', + '-32604': 'ServerBusy', + '-32000': 'CallExecutionFailed', + '-32001': 'UnknownError', + '-32003': 'SubscriptionClosed', + '-32004': 'SubscriptionClosedWithError', + '-32005': 'BatchesNotSupported', + '-32006': 'TooManySubscriptions', + '-32050': 'TransientError', + '-32002': 'TransactionExecutionClientError', }; export class SuiHTTPTransportError extends Error {}