common

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const (
	Vsn                    = "1.0"
	ServiceMethodSeparator = "_"
	ResponseMethodSuffix   = "_response"
)

JSON RPC constants

View Source
const (
	RPCDefaultErrorCode   = -32000
	RPCTimeoutErrorCode   = -32001
	RPCUnmarshalErrorCode = -32002
	RPCInternalErrorCode  = -32500
)

Variables

View Source
var (
	ErrCoreRunning = fmt.Errorf("core is already running")
	ErrCoreStopped = fmt.Errorf("core is stopped")
)
View Source
var DefaultModuleNames = []string{
	builderApiModuleName,
	relayModuleName,
	blockAggregatorName,
	proxyModuleName,
}

Functions

func FormatCommands

func FormatCommands(commands []*cli.Command) ([]*cli.Command, error)

func FormatToAllowed

func FormatToAllowed(name string) (formattedName string, err error)

func NewID

func NewID() string

NewID returns a new, random ID.

Types

type DataError

type DataError interface {
	Error() string          // returns the message
	ErrorData() interface{} // returns the error data
}

A DataError contains some data in addition to the error message.

type Error

type Error interface {
	Error() string  // returns the message
	ErrorCode() int // returns the code
}

Error wraps RPC errors, which contain an error code in addition to the message.

type InternalServerError

type InternalServerError struct {
	Code    int
	Message string
}

InternalServerError is used for server errors during request processing.

func (*InternalServerError) Error

func (e *InternalServerError) Error() string

func (*InternalServerError) ErrorCode

func (e *InternalServerError) ErrorCode() int

type InvalidMessageError

type InvalidMessageError struct{ Message string }

received message is invalid

func (*InvalidMessageError) Error

func (e *InvalidMessageError) Error() string

func (*InvalidMessageError) ErrorCode

func (e *InvalidMessageError) ErrorCode() int

type InvalidParamsError

type InvalidParamsError struct{ Message string }

unable to decode supplied params, or an invalid number of parameters

func (*InvalidParamsError) Error

func (e *InvalidParamsError) Error() string

func (*InvalidParamsError) ErrorCode

func (e *InvalidParamsError) ErrorCode() int

type InvalidRequestError

type InvalidRequestError struct{ Message string }

received message isn't a valid request

func (*InvalidRequestError) Error

func (e *InvalidRequestError) Error() string

func (*InvalidRequestError) ErrorCode

func (e *InvalidRequestError) ErrorCode() int

type MethodNotFoundError

type MethodNotFoundError struct{ Method string }

func (*MethodNotFoundError) Error

func (e *MethodNotFoundError) Error() string

func (*MethodNotFoundError) ErrorCode

func (e *MethodNotFoundError) ErrorCode() int

type ModuleFlags

type ModuleFlags map[string]string

type NotificationsUnsupportedError

type NotificationsUnsupportedError struct{}

func (NotificationsUnsupportedError) Error

func (NotificationsUnsupportedError) ErrorCode

func (e NotificationsUnsupportedError) ErrorCode() int

func (NotificationsUnsupportedError) Is

type ParseError

type ParseError struct{ Message string }

Invalid JSON was received by the server.

func (*ParseError) Error

func (e *ParseError) Error() string

func (*ParseError) ErrorCode

func (e *ParseError) ErrorCode() int

Jump to

Keyboard shortcuts

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