errors

package
v0.21.4 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: GPL-3.0 Imports: 10 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

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

Error error define

func (*Error) Error

func (p *Error) Error() string

func (*Error) FullError

func (p *Error) FullError() string

FullError 全部错误信息

func (*Error) ID

func (p *Error) ID() string

ID 返回ID

func (*Error) Message

func (p *Error) Message() string

Message 信息

func (*Error) Namespace

func (p *Error) Namespace() string

Namespace 错误的域

type ErrorCode

type ErrorCode interface {
	SimpleError
	Code() uint64
	StackTrace() string
	Context() ErrorContext
	Append(err ...error) ErrorCode
	WithContext(k string, v interface{}) ErrorCode
}

ErrorCode Error functions

func NewErrorCode

func NewErrorCode(ofs ...OptionFunc) ErrorCode

NewErrorCode get a new error code

type ErrorCodeTmpl

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

ErrorCodeTmpl error code template

func TN

func TN(namespace string, code uint64, message string) *ErrorCodeTmpl

TN returns a new error code template

func (*ErrorCodeTmpl) New

func (p *ErrorCodeTmpl) New(v ...Params) ErrorCode

New ErrorCodeTmpl new error code by template

type ErrorContext

type ErrorContext map[string]interface{}

ErrorContext map contexts

func (ErrorContext) Error

func (p ErrorContext) Error() string

type ErrorOptions

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

ErrorOptions error parmas

func (*ErrorOptions) NewSimpleError

func (p *ErrorOptions) NewSimpleError() SimpleError

NewSimpleError new simple errors by options

type Errors

type Errors []error

Errors error slice

func NewErrors

func NewErrors(errs ...error) Errors

NewErrors 生成错误数据对象

func (Errors) Append

func (p Errors) Append(errs ...error) Errors

Append 增补错误对象

func (Errors) Error

func (p Errors) Error() string

type Frame

type Frame struct {
	File string
	Line int
	Name string
}

Frame identifies a file, line & function name in the stack.

func (*Frame) ToString

func (p *Frame) ToString() string

ToString frame to string value

type OptionFunc

type OptionFunc func(*ErrorOptions)

OptionFunc set params

func OptionCode

func OptionCode(code uint64) OptionFunc

OptionCode set error code into options

func OptionContext

func OptionContext(ctx map[string]interface{}) OptionFunc

OptionContext set error code into options

func OptionID

func OptionID(id string) OptionFunc

OptionID set id into options

func OptionMesssage

func OptionMesssage(msg string) OptionFunc

OptionMesssage set error code into options

func OptionNamespace

func OptionNamespace(ns string) OptionFunc

OptionNamespace set error code into options

func OptionStackTrace

func OptionStackTrace(stackTrace stack.Stack) OptionFunc

OptionStackTrace set error code into options

type Params

type Params map[string]interface{}

Params template params

type SimpleError

type SimpleError interface {
	ID() string
	Namespace() string
	Message() string
	FullError() string
	Error() string
}

SimpleError simple error functions

func New

func New(text string) SimpleError

New 生成简单对象

func Newf

func Newf(text string, params ...interface{}) SimpleError

Newf 生成简单对象

Jump to

Keyboard shortcuts

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