errcode

package
v0.0.0-...-864b8d0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Success                   = NewError(0, "成功")
	ServerError               = NewError(1000001, "服务内部错误")
	InvalidParams             = NewError(1000002, "入参错误")
	NotFound                  = NewError(1000003, "找不到")
	UnauthorizedAuthNotExist  = NewError(1000004, "鉴权失败,找不到对应的appKey和appSecret")
	UnauthorizedTokenError    = NewError(1000005, "鉴权失败,Token错误")
	UnauthorizedTokenTimeout  = NewError(1000006, "鉴权失败,Token超时")
	UnauthorizedTokenGenerate = NewError(1000007, "鉴权失败,Token生成失败")
	TooManyRequests           = NewError(1000008, "请求过多")
	UnauthorizedError         = NewError(1000009, "Jwt鉴权失败")

	LoginError = NewError(2000001, "登录失败")
)

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    int      `json:"code"`    // 错误编码
	Msg     string   `json:"msg"`     // 错误消息
	Details []string `json:"details"` // 详细消息
}

func NewError

func NewError(code int, msg string) *Error

func (*Error) Detail

func (e *Error) Detail() []string

func (*Error) Error

func (e *Error) Error() string

func (*Error) Msgf

func (e *Error) Msgf(args []interface{}) string

func (*Error) StatusCode

func (e *Error) StatusCode() int

func (*Error) WithDetails

func (e *Error) WithDetails(details ...string) *Error

Jump to

Keyboard shortcuts

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