xerrors

package
v0.10.6 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ModuleDefault = "default"
	ModuleProto   = "protogen"
	ModuleConf    = "confgen"
)
View Source
const (
	// The String method processing logic of Desc is dependent on this key's corresponding value.
	// module: default, proto, conf.
	KeyModule = "Module"

	KeyIndir           = "Indir"           // input dir
	KeySubdir          = "Subdir"          // input subdir
	KeyOutdir          = "Outdir"          // output dir
	KeyBookName        = "BookName"        // workbook name
	KeySheetName       = "SheetName"       // worksheet name
	KeyNameCellPos     = "NameCellPos"     // name cell position
	KeyNameCell        = "NameCell"        // name cell value
	KeyTrimmedNameCell = "TrimmedNameCell" // trimmed name cell value
	KeyTypeCellPos     = "TypeCellPos"     // type cell position
	KeyTypeCell        = "TypeCell"        // type cell value
	KeyDataCellPos     = "DataCellPos"     // data cell position
	KeyDataCell        = "DataCell"        // data data value

	KeyPBMessage   = "PBMessage"   // protobuf message name
	KeyPBFieldName = "PBFieldName" // protobuf message field name
	KeyPBFieldType = "PBFieldType" // protobuf message field type
	KeyPBFieldOpts = "PBFieldOpts" // protobuf message field options (extensions)
	KeyColumnName  = "ColumnName"  // column name

)

desc keys for bookkeeping

Variables

This section is empty.

Functions

func CombineKV

func CombineKV(keysAndValues ...interface{}) string

func E0001

func E0001(sheetName, BookName string) error

E0001 describes sheet not found in book.

func E2001

func E2001(refer string, messageName string) error

E2001 describes field prop "refer" not configured correctly.

func E2002

func E2002(value string, refer string) error

E2002 describes field value not in referred space.

func E2003

func E2003(value string, sequence int64) error

E2002 describes illegal sequence number.

func E2004

func E2004(value interface{}, vrange string) error

E2004 describes value is out of range.

func E2005

func E2005(key interface{}) error

E2005 describes map key is not unique.

func E2006

func E2006(value, enumName interface{}) error

E2006 describes enum value not defined in enum type.

func E2007

func E2007(value, err interface{}) error

E2007 describes invalid datetime format.

func E2008

func E2008(value, err interface{}) error

E2008 describes invalid duration format.

func ErrorKV

func ErrorKV(msg string, keysAndValues ...interface{}) error

ErrorKV returns an error with the supplied message and the key-value pairs as `[|key: value]...` string. ErrorKV also records the stack trace at the point it was called.

func Errorf

func Errorf(format string, args ...interface{}) error

Errorf formats according to a format specifier and returns the string as a value that satisfies error.

func WithMessageKV

func WithMessageKV(err error, keysAndValues ...interface{}) error

WithMessageKV annotates err with the key-value pairs as `[|key: value]...` string. If err is nil, WithMessageKV returns nil.

func WithStack

func WithStack(err error) error

WithStack annotates err with a stack trace at the point WithStack was called. If err is nil, WithStack returns nil.

func WrapKV

func WrapKV(err error, keysAndValues ...interface{}) error

WrapKV formats the key-value pairs as `[|key: value]...` string and returns the string as a value that satisfies error. WrapKV also records the stack trace at the point it was called.

Types

type Desc

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

func NewDesc

func NewDesc(err error) *Desc

func (*Desc) DebugString

func (d *Desc) DebugString() string

func (*Desc) String

func (d *Desc) String() string

String render description in specified language.

Jump to

Keyboard shortcuts

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