errors

package
v1.8.4 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: GPL-3.0 Imports: 10 Imported by: 2

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 added in v1.7.0

func (p *Error) Error() string

func (*Error) FullError added in v1.8.3

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 added in v1.7.0

func (p ErrorContext) Error() string

type ErrorOptions added in v1.7.0

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

ErrorOptions error parmas

func (*ErrorOptions) NewSimpleError added in v1.7.0

func (p *ErrorOptions) NewSimpleError() SimpleError

NewSimpleError new simple errors by options

type Errors added in v1.7.0

type Errors []error

Errors error slice

func NewErrors added in v1.7.0

func NewErrors(errs ...error) Errors

NewErrors 生成错误数据对象

func (Errors) Append added in v1.7.0

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

Append 增补错误对象

func (Errors) Error added in v1.7.0

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 added in v1.7.0

type OptionFunc func(*ErrorOptions)

OptionFunc set params

func OptionCode added in v1.7.0

func OptionCode(code uint64) OptionFunc

OptionCode set error code into options

func OptionContext added in v1.7.0

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

OptionContext set error code into options

func OptionID added in v1.7.0

func OptionID(id string) OptionFunc

OptionID set id into options

func OptionMesssage added in v1.7.0

func OptionMesssage(msg string) OptionFunc

OptionMesssage set error code into options

func OptionNamespace added in v1.7.0

func OptionNamespace(ns string) OptionFunc

OptionNamespace set error code into options

func OptionStackTrace added in v1.7.0

func OptionStackTrace(stackTrace stack.Stack) OptionFunc

OptionStackTrace set error code into options

type Params

type Params map[string]interface{}

Params template params

type SimpleError added in v1.7.0

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

SimpleError simple error functions

func New added in v1.7.0

func New(text string) SimpleError

New 生成简单对象

func Newf added in v1.7.0

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