rpccode

package
v0.9.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 3 Imported by: 0

README

RPC Codes

This document describes error codes from the service for different custom cases

Ranges

  • 1000 - 2999 Success responses
  • 3000 - 3999 Not successful at the moment. Need to wait.
  • 4000 - 4999 Failed responses

Full table with all rpc codes

Code Name Description
3000 Not enough Not enough balance or resources on the wallet
3001 Address is taken The address is occupied by another transaction
3002 Max fee exceeded Max fee value exceeded
3003 Resource manager is disabled Resource manager disabled
4000 Blockchain is disabled At the moment this blockchain is disabled
4001 Zero balance Empty balance on current address

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RPCCodes = map[RPCCode]error{
	RPCCodeNotEnoughResources:   errors.New("not enough resources"),
	RPCCodeAddressIsTaken:       errors.New("the address is occupied by another transaction"),
	RPCCodeMaxFeeExceeded:       errors.New("max fee value exceeded"),
	RPCCodeBlockchainIsDisabled: errors.New("blockchain is disabled"),
	RPCCodeAddressEmptyBalance:  errors.New("address empty balance"),
	RPCCodeNotEnoughBalance:     errors.New("not enough balance"),
	RPCCodeServiceUnavailable:   errors.New("service unavailable"),
}

Functions

func GetErrorByCode

func GetErrorByCode(code RPCCode) error

Types

type RPCCode

type RPCCode uint32
const (
	RPCCodeNotEnoughResources   RPCCode = 3000
	RPCCodeAddressIsTaken       RPCCode = 3001
	RPCCodeMaxFeeExceeded       RPCCode = 3002
	RPCCodeServiceUnavailable   RPCCode = 3003
	RPCCodeNotEnoughBalance     RPCCode = 3004
	RPCCodeBlockchainIsDisabled RPCCode = 4000
	RPCCodeAddressEmptyBalance  RPCCode = 4001
)

func NewConnectError

func NewConnectError(connectCode connect.Code, err error) (RPCCode, error)

NewConnectError creates a new connectrpc error with the given connect code and error.

func (RPCCode) String

func (c RPCCode) String() string

String returns the string representation of the RPC code.

type RPCError

type RPCError struct {
	Code  RPCCode
	Error error
}

func IsRPCError

func IsRPCError(err error) (RPCError, bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL