error

package
v0.0.0-...-0025a43 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_ERROR     = 40000 // 默认错误
	VALIDATE_ERROR    = 42200 // 验证错误
	TOKEN_ERROR       = 40100 // Token失效
	FORBIDDEN         = 40300 // 无权限
	NOT_FOUND         = 40400 // 数据不存在
	TOO_MANY_REQUESTS = 42900 // 请求过于频繁
	USER_NOT_FOUND    = 40401 // 用户不存在
	SERVER_ERROR      = 50000 // 服务器错误
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

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

func BadRequest

func BadRequest(errorMsg string, errorCode ...int) *Error

func Forbidden

func Forbidden(errorMsg string, errorCode ...int) *Error

func InternalServer

func InternalServer(errorMsg string) *Error

func New

func New(httpCode, errorCode int, errorMsg string) *Error

func NotFound

func NotFound(errorMsg string, errorCode ...int) *Error

func TooManyRequestsErr

func TooManyRequestsErr(errorMsg string) *Error

func Unauthorized

func Unauthorized(errorMsg string, errorCode ...int) *Error

func ValidateErr

func ValidateErr(errorMsg string) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) ErrorCode

func (e *Error) ErrorCode() int

func (*Error) HttpCode

func (e *Error) HttpCode() int

Jump to

Keyboard shortcuts

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