errors

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: Apache-2.0, BSD-2-Clause Imports: 10 Imported by: 1

Documentation

Index

Constants

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

parameters

Variables

View Source
var (
	FuncRegisterError         = coreutil.Func("registerError")
	ViewGetErrorMessageFormat = coreutil.ViewFunc("getErrorMessageFormat")
)
View Source
var Contract = coreutil.NewContract(coreutil.CoreContractErrors, "Errors contract")
View Source
var Processor = Contract.Processor(initialize,
	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)

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