errorcode

package
v0.0.0-...-4fbe3ce Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2018 License: Apache-2.0 Imports: 1 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Global Error
	OK                  = NewError(0, "ok")
	ErrBadRequest       = NewError(4001001, "bad request")
	ErrAuthExpired      = NewError(4001002, "auth expired")
	ErrClientDeprecated = NewError(4001003, "this version of client is deprecated")
	ErrServerError      = NewError(5001001, "server error")
	ErrServerBusy       = NewError(5001002, "server busy")
	ErrNoModuleInfo     = NewError(5001003, "no such module")
)
View Source
var (
	// error code format: 0x[1byte,module_no][1byte,reserve][2byte,error_no]
	// db error, module_no=0x01
	ErrInnerDBConfigError        = NewInnerError(0x01000001, "db config error")
	ErrInnerDBQueryUserMsgError  = NewInnerError(0x01000002, "query user msg error")
	ErrInnerDBFormatSQLError     = NewInnerError(0x01000003, "format sql error")
	ErrInnerDBUpdateUserMsgError = NewInnerError(0x01000004, "update user msg error")
	ErrInnerDBInsertUserMsgError = NewInnerError(0x01000005, "insert user msg error")

	// service error, module_no=0x02
	ErrInnerWrongParam       = NewInnerError(0x02000001, "wrong param")
	ErrInnerInvalidToken     = NewInnerError(0x02000002, "invalid token")
	ErrInnerHTTPReqError     = NewInnerError(0x02000003, "http request error")
	ErrInnerHTTPRespError    = NewInnerError(0x02000004, "http response error")
	ErrInnerJSONEncodeError  = NewInnerError(0x02000005, "json encode error")
	ErrInnerJSONDecodeError  = NewInnerError(0x02000006, "json decode error")
	ErrInnerQueryModuleError = NewInnerError(0x02000007, "query module error")
)

Functions

This section is empty.

Types

type BaseError

type BaseError struct {
	Ret int
	Msg string
}

func NewError

func NewError(ret int, msg string) BaseError

func (BaseError) Error

func (e BaseError) Error() string

type InnerError

type InnerError struct {
	BaseError
}

func NewInnerError

func NewInnerError(ret int, msg string) InnerError

func (InnerError) Error

func (e InnerError) Error() string

Jump to

Keyboard shortcuts

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