http_error

package
v0.0.0-...-f8ab5ae Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrGenericServerError   = -1
	ErrNoAccessPermission   = 1
	ErrLoginUsernameIsEmpty = 2
	ErrMissingParameter     = 3
	ErrIllegalParameter     = 4
	ErrDuplicateRecord      = 5
)

Variables

View Source
var (
	GenericServerError = rest.ResponseBase{
		Code:    ErrGenericServerError,
		Message: "服务返回错误",
	}

	NoAccessPermission = rest.ResponseBase{
		Code:    ErrNoAccessPermission,
		Message: "没有访问权限",
	}

	LoginUsernameIsEmpty = rest.ResponseBase{
		Code:    ErrLoginUsernameIsEmpty,
		Message: "用户名不能为空",
	}

	MissingParameter = rest.ResponseBase{
		Code:    ErrMissingParameter,
		Message: "字段填写不完整",
	}

	IllegalParameter = rest.ResponseBase{
		Code:    ErrIllegalParameter,
		Message: "字段非法",
	}

	DuplicateRecord = rest.ResponseBase{
		Code:    ErrDuplicateRecord,
		Message: "重复数据",
	}
)

这里包含一些预定义的错误码和提示信息

Functions

func GetError

func GetError(err error) rest.ResponseBase

func GetErrorFromString

func GetErrorFromString(errMessage string) rest.ResponseBase

Types

This section is empty.

Jump to

Keyboard shortcuts

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