Skip to content

Commit

Permalink
[ts sdk] Add more JSON rpc error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
hayes-mysten committed May 24, 2024
1 parent 3e1d716 commit 31e400b
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 31e400b

Please sign in to comment.