errors

package
v1.0.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ParamErrorCode          = "c"
	ParamErrorMessageFormat = "m"
)

request parameters

Variables

View Source
var (
	FuncRegisterError = coreutil.Func("registerError")

	ViewGetErrorMessageFormat = coreutil.ViewFunc("getErrorMessageFormat")
)
View Source
var Processor = Contract.Processor(nil,
	FuncRegisterError.WithHandler(funcRegisterError),
	ViewGetErrorMessageFormat.WithHandler(funcGetErrorMessageFormat),
)

Functions

func GetMessageFormat

func GetMessageFormat(code isc.VMErrorCode, callView ViewCaller) (string, error)

func NewStateErrorCollectionReader

func NewStateErrorCollectionReader(partition kv.KVStoreReader, hname isc.Hname) coreerrors.ErrorCollection

func NewStateErrorCollectionWriter

func NewStateErrorCollectionWriter(partition kv.KVStore, hname isc.Hname) coreerrors.ErrorCollection

func Resolve

func Resolve(e *isc.UnresolvedVMError, callView ViewCaller) (*isc.VMError, error)

func ResolveFromState

func ResolveFromState(state kv.KVStoreReader, e *isc.UnresolvedVMError) (*isc.VMError, error)

func SetInitialState added in v1.0.3

func SetInitialState(state kv.KVStore)

Types

type StateErrorCollectionReader

type StateErrorCollectionReader struct {
	// contains filtered or unexported fields
}

StateErrorCollectionReader implements ErrorCollection partially. Is used for contract internal error readings only. It requires a reference to a KVStoreReader such as the vmctx and the hname of the caller.

func (*StateErrorCollectionReader) Get

func (*StateErrorCollectionReader) Register

func (e *StateErrorCollectionReader) Register(messageFormat string) (*isc.VMErrorTemplate, error)

type StateErrorCollectionWriter

type StateErrorCollectionWriter struct {
	// contains filtered or unexported fields
}

StateErrorCollectionWriter implements ErrorCollection. Is used for contract internal errors. It requires a reference to a KVStore such as the vmctx and the hname of the caller.

func (*StateErrorCollectionWriter) Get

func (*StateErrorCollectionWriter) Register

func (e *StateErrorCollectionWriter) Register(messageFormat string) (*isc.VMErrorTemplate, error)

type ViewCaller

type ViewCaller func(contractName string, funcName string, params dict.Dict) (dict.Dict, error)

ViewCaller is a generic interface for any function that can call views

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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