error

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TcpSuccess     = 0
	Success        = 200
	BadRequest     = 400
	Unauthorized   = 401
	Forbidden      = 403
	NotFound       = 404
	SystemError    = 500
	ParameterError = 600
	DBError        = 701
	CacheError     = 702

	UnknownError = "unknown error"

	ErrMap = map[int]string{
		TcpSuccess:     "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",
	}
)

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