errors

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: GPL-3.0 Imports: 9 Imported by: 4

README

errors

errors

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrsString

func ErrsString(errs []error) string

ErrsString get errors string

Types

type Error

type Error struct {
	ID        string `json:"id"`
	Namespace string `json:"namespace"`
	Code      uint64 `json:"code"`
	Message   string `json:"message"`
}

Error error define

type ErrorCode

type ErrorCode interface {
	ID() string
	Code() uint64
	Namespace() string
	Error() string
	StackTrace() string
	Context() ErrorContext
	FullError() error
	Append(err ...interface{}) ErrorCode
	WithContext(k string, v interface{}) ErrorCode
	Marshal() ([]byte, error)
}

ErrorCode Error functions

func NewErrorCode

func NewErrorCode(
	errorid string, code uint64, namespace string, message string,
	stackTrace string, context map[string]interface{}) 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) String

func (p ErrorContext) String() 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 Params

type Params map[string]interface{}

Params template params

Jump to

Keyboard shortcuts

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