derror

package
v1.7.9 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RpcSuccess             = 0
	Success                = 200
	BadRequest             = 400
	Unauthorized           = 401
	Forbidden              = 403
	NotFound               = 404
	SystemError            = 500
	ParameterError         = 600
	DBError                = 701
	CacheError             = 702
	RpcTimeout             = 10001
	RpcOverflow            = 10002
	RpcInternalServerError = 10003
	RpcInvalidParam        = 10004

	UnknownError = "unknown error"

	ErrMap = map[int]string{
		RpcSuccess:             "ok",
		Success:                "ok",
		BadRequest:             "bad request",
		Unauthorized:           "Unauthorized",
		Forbidden:              "Forbidden",
		NotFound:               "not found",
		SystemError:            "system error",
		ParameterError:         "Parameter error",
		DBError:                "db error",
		CacheError:             "cache error",
		RpcTimeout:             "timeout error",
		RpcOverflow:            "overflow error",
		RpcInternalServerError: "interval server error",
		RpcInvalidParam:        "invalid param",
	}
)

Functions

func GetErrorType

func GetErrorType(code int) string

Types

type CodeError

type CodeError struct {
	// contains filtered or unexported fields
}

func MakeCodeError

func MakeCodeError(code int, e error) *CodeError

func MakeHttpErrorByStatusCode

func MakeHttpErrorByStatusCode(statusCode int) *CodeError

func NewCodeError

func NewCodeError(code int, format string, args ...interface{}) *CodeError

func SetCodeType

func SetCodeType(code int, errType string) *CodeError

func (*CodeError) Code

func (err *CodeError) Code() int

func (*CodeError) Detail

func (err *CodeError) Detail() string

func (*CodeError) Error

func (err *CodeError) Error() string

func (*CodeError) SetMsg

func (err *CodeError) SetMsg(msg string) *CodeError

func (*CodeError) String

func (err *CodeError) String() string

func (*CodeError) ToString

func (err *CodeError) ToString() []byte

func (*CodeError) Type

func (err *CodeError) Type() string

Jump to

Keyboard shortcuts

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