perrors

package
v0.0.27 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Err_name = map[int32]string{
		0: "UNKNOWN",
		1: "INVALID_PARAMS",
		2: "NOT_FOUND",
		3: "ALREADY_EXISTS",
		4: "PERMISSION_DENIED",
		5: "UNAUTHORIZED",
	}
	Err_value = map[string]int32{
		"UNKNOWN":           0,
		"INVALID_PARAMS":    1,
		"NOT_FOUND":         2,
		"ALREADY_EXISTS":    3,
		"PERMISSION_DENIED": 4,
		"UNAUTHORIZED":      5,
	}
)

Enum value maps for Err.

View Source
var File_perrors_error_proto protoreflect.FileDescriptor

Functions

func ErrorAlreadyExists

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

数据已存在

func ErrorInvalidParams

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

参数错误

func ErrorNotFound

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

资源不存在

func ErrorPermissionDenied

func ErrorPermissionDenied(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 IsAlreadyExists

func IsAlreadyExists(err error) bool

数据已存在

func IsInvalidParams

func IsInvalidParams(err error) bool

参数错误

func IsNotFound

func IsNotFound(err error) bool

资源不存在

func IsPermissionDenied

func IsPermissionDenied(err error) bool

权限不足

func IsUnauthorized

func IsUnauthorized(err error) bool

未登录

func IsUnknown

func IsUnknown(err error) bool

未知错误

Types

type Err

type Err int32
const (
	// 未知错误
	Err_UNKNOWN Err = 0
	// 参数错误
	Err_INVALID_PARAMS Err = 1
	// 资源不存在
	Err_NOT_FOUND Err = 2
	// 数据已存在
	Err_ALREADY_EXISTS Err = 3
	// 权限不足
	Err_PERMISSION_DENIED Err = 4
	// 未登录
	Err_UNAUTHORIZED Err = 5
)

func (Err) Descriptor

func (Err) Descriptor() protoreflect.EnumDescriptor

func (Err) Enum

func (x Err) Enum() *Err

func (Err) EnumDescriptor deprecated

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

Deprecated: Use Err.Descriptor instead.

func (Err) Number

func (x Err) Number() protoreflect.EnumNumber

func (Err) String

func (x Err) String() string

func (Err) Type

func (Err) Type() protoreflect.EnumType

Jump to

Keyboard shortcuts

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