distill_errors

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(err error, fmtAndArgs ...interface{}) error

func NotFoundErr

func NotFoundErr(err error, fmtAndArgs ...interface{}) error

NotFoundErr use http.StatusNotFound as StatusCode to express not found err if fmtAndArgs is not nil, update the Message according to fmtAndArgs

Types

type MErr

type MErr struct {
	Message    string // 保存自定义的错误信息
	StatusCode int    // 错误状态码
	// contains filtered or unexported fields
}

func WrapErr

func WrapErr(err error, fmtAndArgs ...interface{}) *MErr

WrapErr equal to InternalErr(err) notice: be careful, the returned value is *MErr, not error

func WrapErrWithCode

func WrapErrWithCode(err error, code int, fmtAndArgs ...interface{}) *MErr

WrapErrWithCode if code is not 0, update StatusCode to code, if fmtAndArgs is not nil, update the Message according to fmtAndArgs notice: be careful, the returned value is *MErr, not error

func (MErr) CallStack

func (e MErr) CallStack() string

CallStack get function call stack

func (*MErr) Error

func (e *MErr) Error() string

func (MErr) RawErr

func (e MErr) RawErr() error

RawErr the origin err

Jump to

Keyboard shortcuts

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