Skip to content

Commit

Permalink
neorpc: add deprecated error codes for C#-compatibility
Browse files Browse the repository at this point in the history
While our server no longer uses these codes (-100, -400) they still can come
from C# servers and while we consider them deprecated we better at least have
some definition of them until C# implements our proposal:
neo-project/proposals#156
Also adding description of deprecated RPC error codes in ROADMAP.md.

Signed-off-by: Tatiana Nesterenko <tatiana@nspcc.io>
  • Loading branch information
tatiana-nspcc committed Aug 16, 2023
1 parent 3178c8f commit 3b29720
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,11 @@ hidden under `version` label and `server_id` contains network server ID hidden
under `server_id` label.

Removal of `serv_node_version` is scheduled for Sep-Oct 2023 (~0.105.0 release).

## RPC error codes returned by old versions and C#-nodes

NeoGo retains certain deprecated error codes: `neorpc.ErrCompatGeneric`,
`neorpc.ErrCompatNoOpenedWallet`. They returned by nodes not compliant with the
neo-project/proposals#156 (NeoGo pre-0.102.0 and all known C# versions).

Removal of the deprecated RPC error codes is planned once all nodes adopt the new error standard.
15 changes: 15 additions & 0 deletions pkg/neorpc/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,21 @@ const (
ErrExecutionFailedCode = -608
)

var (
// ErrCompatGeneric is an error returned by nodes not compliant with the neo-project/proposals#156
// (NeoGo pre-0.102.0 and all known C# versions).
// It can be returned for any call and doesn't have any specific meaning.
//
// Deprecated: to be removed after all nodes adopt new error standard.
ErrCompatGeneric = NewErrorWithCode(-100, "RPC error")

// ErrCompatNoOpenedWallet is an error code returned by nodes not compliant with the neo-project/proposals#156
// (all known C# versions, NeoGo never used this code). It can be returned for wallet-related operations.
//
// Deprecated: to be removed after all nodes adopt new error standard.
ErrCompatNoOpenedWallet = NewErrorWithCode(-400, "No opened wallet")
)

var (
// ErrInvalidParams represents a generic "Invalid params" error.
ErrInvalidParams = NewInvalidParamsError("Invalid params")
Expand Down

0 comments on commit 3b29720

Please sign in to comment.