errorcode

package
v0.0.0-...-3cb022a Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// gf框架内置的,参见:github.com\gogf\gf\v2@v2.0.0-rc2\errors\gcode\gcode.go
	CodeNil           = New(200, -1, "")
	CodeNotFound      = New(404, 65, "Not Found")
	CodeInternalError = New(500, 50, "An error occurred internally")

	// 系统起始 10000
	MyInternalError = New(500, 10001, "{#myInternalError}")

	// token 20000起始
	AuthHeaderInvalidError     = New(401, 20001, `{#authHeaderInvalidError}`)
	NotSupportedCacheModeError = New(401, 20002, `{#notSupportedCacheModeError}`)
	TokenEmpty                 = New(401, 20003, `{#tokenEmpty}`)
	TokenKeyEmpty              = New(401, 20004, `{#tokenKeyEmpty}`)
	TokenInvalidError          = New(401, 20005, `{#tokenInvalidError}`)
	Unauthorized               = New(401, 20006, `{#unauthorized}`)
	AuthorizedFailed           = New(401, 20007, `{#authorizedFailed}`)

	//用户30000起始
	UserNotFound        = New(404, 30001, `{#userNotExists}`)
	LoginNameConflicted = New(403, 30002, `{#loginNameConflicted}`)
	PasswordError       = New(401, 30003, `{#passwordError}`)
	LoginFailed         = New(401, 30004, `{#loginFailed}`)
	LogoutFailed        = New(401, 30005, `{#logoutFailed}`)

	// 桌面40000起始
	DesktopNotFound = New(404, 40001, `{#desktopNotExists}`)

	// 删除异常
	BadDelete = New(200, 500, `{#非法删除}`)
)

Functions

func MyWrapCode

func MyWrapCode(ctx context.Context, code gcode.Code, err error, params ...interface{}) error

func New

func New(httpCode int, code int, message string) gcode.Code

func NewMyErr

func NewMyErr(ctx context.Context, code gcode.Code, params ...interface{}) error

Types

type MyCode

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

func (MyCode) Code

func (c MyCode) Code() int

func (MyCode) Detail

func (c MyCode) Detail() interface{}

func (MyCode) Message

func (c MyCode) Message() string

func (MyCode) MyDetail

func (c MyCode) MyDetail() MyCodeDetail

type MyCodeDetail

type MyCodeDetail struct {
	HttpCode int
}

Jump to

Keyboard shortcuts

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