Skip to content

Commit

Permalink
[ts sdk] Add more JSON rpc error codes (#17924)
Browse files Browse the repository at this point in the history
## Description 

Describe the changes or additions included in this PR.

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
  • Loading branch information
hayes-mysten authored May 24, 2024
1 parent 5094b7e commit ebdfe7c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/bright-wombats-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mysten/sui.js': patch
---

Add support for more JSON RPC error codes
11 changes: 11 additions & 0 deletions sdk/typescript/src/client/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,21 @@

const CODE_TO_ERROR_TYPE: Record<number, string> = {
'-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 {}
Expand Down

0 comments on commit ebdfe7c

Please sign in to comment.