dcodes

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllCodes []Code //for print

Functions

This section is empty.

Types

type Code

type Code interface {
	Error() string
	// GetDetails get error details,it may help developers
	GetDetails() []string
	// Unwrap unwrap the error
	Unwrap() error
	// UnWrapError unwrap the error to get the error messages
	UnWrapError() string
	//WithDetails make new code with details
	WithDetails(details ...string) Code
	//Wrap wrap sub error
	Wrap(err error) Code
	//WrapWithDetails wrap sub error and some details
	WrapWithDetails(err error, details ...string) Code
	//Copy make an error copy
	Copy() Code
}

func New

func New(errMsg string, details ...string) Code

New make a new code

type ECode

type ECode struct {
	ErrorMsg string //系统内部信息
	Details  []string
	// contains filtered or unexported fields
}

func (*ECode) Copy added in v0.9.0

func (err *ECode) Copy() Code

func (*ECode) Error

func (err *ECode) Error() string

func (*ECode) GetDetails

func (err *ECode) GetDetails() []string

func (*ECode) Is

func (err *ECode) Is(e error) bool

Is for compare ,implementation of errs.Is

func (*ECode) UnWrapError

func (err *ECode) UnWrapError() string

func (*ECode) Unwrap

func (err *ECode) Unwrap() error

func (*ECode) WithDetails

func (err *ECode) WithDetails(details ...string) Code

func (*ECode) Wrap

func (err *ECode) Wrap(subErr error) Code

func (*ECode) WrapWithDetails

func (err *ECode) WrapWithDetails(subErr error, details ...string) Code

Jump to

Keyboard shortcuts

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