Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorCode ¶
type ErrorCode interface { SimpleError Code() uint64 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(opts ...Option) 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 OptionFunc ¶
type OptionFunc func(*ErrorOptions)
OptionFunc set params
func OptionContext ¶
func OptionContext(ctx map[string]interface{}) OptionFunc
OptionContext set error context into options
func OptionErrs ¶ added in v0.21.15
func OptionErrs(errs ...error) OptionFunc
OptionErrs append errs
func OptionMesssage ¶
func OptionMesssage(msg string) OptionFunc
OptionMesssage set error message into options
func OptionNamespace ¶
func OptionNamespace(ns string) OptionFunc
OptionNamespace set error code into options
Click to show internal directories.
Click to hide internal directories.