goerrcode

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: MIT Imports: 4 Imported by: 0

README

goerrcode

用了https://github.com/pkg/errors 后,想要一个更实用的错误码模块

test

go test -v -count=1 .

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RetCodeSuccess int = 0
	MsgSuccess         = "success"
	CodeMsgSuccess     = NewRetCodeMsg(RetCodeSuccess, MsgSuccess)

	RetCodeFailure int = 1
	MsgFailure         = "failure"
	CodeMsgFailure     = NewRetCodeMsg(RetCodeFailure, MsgFailure)

	RetCodeUnknown int = 2
	MsgUnknown         = "unknown"
	CodeMsgUnknown     = NewRetCodeMsg(RetCodeUnknown, MsgUnknown)
)

Functions

func Cause

func Cause(err error) error

func JsonStr added in v0.1.4

func JsonStr(err error) string

func Message

func Message(err error) string

func NewRetCodeMsg

func NewRetCodeMsg(retcode int, msg string) *withRetCodeMessage

func NewStack

func NewStack() *internal.MyStack

func RetCode

func RetCode(err error) int

func RetCodeMsg

func RetCodeMsg(err error) *withRetCodeMessage

func Stack

func Stack(err error) *internal.MyStack

func UnSafeInitCodeSet

func UnSafeInitCodeSet()

func WithMessage

func WithMessage(err error, msg string) error

func WithRetCode

func WithRetCode(err error, retCode int) error

func WithRetCodeMessage

func WithRetCodeMessage(err error, rm *withRetCodeMessage) error

func WithRetCodeMessagef

func WithRetCodeMessagef(err error, retCode int, format string, args ...interface{}) error

func WithStack

func WithStack(err error) error

Types

This section is empty.

Directories

Path Synopsis
sample module

Jump to

Keyboard shortcuts

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