zerrors

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 17 Imported by: 0

README

zerrors

zerrors 包保存一些通用的错误。包括:

  • 声明式组件错误
  • 命令式组件错误

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorReason_name = map[int32]string{
		0: "Unknown",
		1: "InvalidParameter",
		2: "NotFound",
		3: "Unauthorized",
		4: "Forbidden",
		5: "IdempotentMissingToken",
		6: "IdempotentTokenExpired",
	}
	ErrorReason_value = map[string]int32{
		"Unknown":                0,
		"InvalidParameter":       1,
		"NotFound":               2,
		"Unauthorized":           3,
		"Forbidden":              4,
		"IdempotentMissingToken": 5,
		"IdempotentTokenExpired": 6,
	}
)

Enum value maps for ErrorReason.

View Source
var File_zerrors_zerrors_proto protoreflect.FileDescriptor

Functions

func ErrorForbidden

func ErrorForbidden(format string, args ...interface{}) *errors.Error

禁止访问错误

func ErrorIdempotentMissingToken

func ErrorIdempotentMissingToken(format string, args ...interface{}) *errors.Error

缺少幂等性令牌错误

func ErrorIdempotentTokenExpired

func ErrorIdempotentTokenExpired(format string, args ...interface{}) *errors.Error

幂等性令牌已过期错误

func ErrorInvalidParameter

func ErrorInvalidParameter(format string, args ...interface{}) *errors.Error

无效参数错误

func ErrorNotFound

func ErrorNotFound(format string, args ...interface{}) *errors.Error

未找到错误

func ErrorUnauthorized

func ErrorUnauthorized(format string, args ...interface{}) *errors.Error

未经授权错误

func ErrorUnknown

func ErrorUnknown(format string, args ...interface{}) *errors.Error

未知错误,服务器内部错误

func IsForbidden

func IsForbidden(err error) bool

禁止访问错误

func IsIdempotentMissingToken

func IsIdempotentMissingToken(err error) bool

缺少幂等性令牌错误

func IsIdempotentTokenExpired

func IsIdempotentTokenExpired(err error) bool

幂等性令牌已过期错误

func IsInvalidParameter

func IsInvalidParameter(err error) bool

无效参数错误

func IsNotFound

func IsNotFound(err error) bool

未找到错误

func IsUnauthorized

func IsUnauthorized(err error) bool

未经授权错误

func IsUnknown

func IsUnknown(err error) bool

未知错误,服务器内部错误

Types

type ErrorReason

type ErrorReason int32
const (
	// 未知错误,服务器内部错误
	ErrorReason_Unknown ErrorReason = 0
	// 无效参数错误
	ErrorReason_InvalidParameter ErrorReason = 1
	// 未找到错误
	ErrorReason_NotFound ErrorReason = 2
	// 未经授权错误
	ErrorReason_Unauthorized ErrorReason = 3
	// 禁止访问错误
	ErrorReason_Forbidden ErrorReason = 4
	// 缺少幂等性令牌错误
	ErrorReason_IdempotentMissingToken ErrorReason = 5
	// 幂等性令牌已过期错误
	ErrorReason_IdempotentTokenExpired ErrorReason = 6
)

func (ErrorReason) Descriptor

func (ErrorReason) Enum

func (x ErrorReason) Enum() *ErrorReason

func (ErrorReason) EnumDescriptor deprecated

func (ErrorReason) EnumDescriptor() ([]byte, []int)

Deprecated: Use ErrorReason.Descriptor instead.

func (ErrorReason) Number

func (x ErrorReason) Number() protoreflect.EnumNumber

func (ErrorReason) String

func (x ErrorReason) String() string

func (ErrorReason) Type

Jump to

Keyboard shortcuts

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