errcode

package
v0.0.0-...-dcbaf51 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MulanPSL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package errcode 错误处理包

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInternal       = errors.New("服务器内部错误")
	ErrAuthCheckToken = errors.New("解析TOKEN失败")
)
View Source
var (
	ErrTooManyRequest            = errors.New("服务器繁忙")
	ErrAuthCheckTokenTimeOut     = errors.New("TOKEN过期")
	ErrAuth                      = errors.New("TOKEN错误")
	ErrPermissionDenied          = errors.New("权限不足")
	ErrParamTypeError            = errors.New("参数错误")
	ErrUsernameHadBeenRegistered = errors.New("用户名已被注册")
	ErrLoginFail                 = errors.New("登录失败")
)

Functions

This section is empty.

Types

type Coder

type Coder interface {
	// HTTPStatus  HTTP status that should be used for the associated error code.
	HTTPStatus() int

	// Code returns the code of the coder
	Code() int

	// String External (user) facing error text.
	String() string

	// Error 返回error
	Error() error
}

func ParseCoder

func ParseCoder(err error) Coder

ParseCoder parse any error into *withCode. nil error will return nil direct. None withStack error will be parsed as ErrUnknown.

Jump to

Keyboard shortcuts

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