errors

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: Apache-2.0 Imports: 6 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetCustomOutputFunction added in v0.0.4

func SetCustomOutputFunction(cof CustomOutputFunc)

func SetErrorOutputFormat added in v0.0.4

func SetErrorOutputFormat(format RichErrorOutputFormat)

Types

type CustomOutputFunc added in v0.0.4

type CustomOutputFunc func(e ReadOnlyRichError) string

type ReadOnlyRichError

type ReadOnlyRichError interface {
	GetErrorCode() string
	GetErrorMessage() string
	GetStack() []callStackEntry
	GetSource() string
	GetFunction() string
	GetLineNumber() string
	GetTags() []string
	GetMetaData() map[string]interface{}
	GetMetaDataItem(key string) (interface{}, bool)
	GetErrors() []error
	HasStack() bool
	ToString(format RichErrorOutputFormat) string
	ToCustomString(cof CustomOutputFunc) string

	error
}

type RichError

type RichError interface {
	WithStack(stackOffset int) RichError
	WithMetaData(metaData map[string]interface{}) RichError
	WithErrors(errs []error) RichError
	WithTags(tags []string) RichError
	AddSource(source string) RichError
	AddFunction(function string) RichError
	AddLineNumber(lineNumber string) RichError
	AddMetaData(key string, value interface{}) RichError
	AddError(err error) RichError
	AddTag(tag string) RichError

	ReadOnlyRichError
}

func NewRichError

func NewRichError(errCode, message string) RichError

func NewRichErrorWithStack

func NewRichErrorWithStack(errCode, message string, stackOffset int) RichError

type RichErrorOutputFormat added in v0.0.4

type RichErrorOutputFormat int
const (
	NotSpecified RichErrorOutputFormat = iota
	CustomOutput
	DetailedOutput
	FullOutputFormatted
	FullOutputInline
	ShortDetailedOutput
	ShortOutput
)

Jump to

Keyboard shortcuts

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