errorcode

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCode_name = map[int32]string{
		0:     "Success",
		1:     "Canceled",
		2:     "Unknown",
		3:     "InvalidArgument",
		4:     "DeadlineExceeded",
		5:     "NotFound",
		6:     "AlreadyExists",
		7:     "PermissionDenied",
		8:     "ResourceExhausted",
		9:     "FailedPrecondition",
		10:    "Aborted",
		11:    "OutOfRange",
		12:    "Unimplemented",
		13:    "Internal",
		14:    "Unavailable",
		15:    "DataLoss",
		16:    "Unauthenticated",
		10000: "SysError",
		21000: "DBError",
		21001: "RowExists",
		22000: "RedisErr",
		30000: "IOError",
		30001: "UploadFail",
		30002: "UploadCheckFail",
		30003: "UploadCheckFormat",
		30004: "TimeTooMuch",
		30005: "ParamInvalid",
	}
	ErrCode_value = map[string]int32{
		"Success":            0,
		"Canceled":           1,
		"Unknown":            2,
		"InvalidArgument":    3,
		"DeadlineExceeded":   4,
		"NotFound":           5,
		"AlreadyExists":      6,
		"PermissionDenied":   7,
		"ResourceExhausted":  8,
		"FailedPrecondition": 9,
		"Aborted":            10,
		"OutOfRange":         11,
		"Unimplemented":      12,
		"Internal":           13,
		"Unavailable":        14,
		"DataLoss":           15,
		"Unauthenticated":    16,
		"SysError":           10000,
		"DBError":            21000,
		"RowExists":          21001,
		"RedisErr":           22000,
		"IOError":            30000,
		"UploadFail":         30001,
		"UploadCheckFail":    30002,
		"UploadCheckFormat":  30003,
		"TimeTooMuch":        30004,
		"ParamInvalid":       30005,
	}
)

Enum value maps for ErrCode.

View Source
var File_cherry_protobuf_errorcode_enum_proto protoreflect.FileDescriptor
View Source
var File_cherry_protobuf_errorcode_errrep_proto protoreflect.FileDescriptor

Functions

func Code

func Code(err error) int

func ErrHandle

func ErrHandle(err interface{}) error

Types

type ErrCode

type ErrCode int32
const (
	Success            ErrCode = 0
	Canceled           ErrCode = 1
	Unknown            ErrCode = 2
	InvalidArgument    ErrCode = 3
	DeadlineExceeded   ErrCode = 4
	NotFound           ErrCode = 5
	AlreadyExists      ErrCode = 6
	PermissionDenied   ErrCode = 7
	ResourceExhausted  ErrCode = 8
	FailedPrecondition ErrCode = 9
	Aborted            ErrCode = 10
	OutOfRange         ErrCode = 11
	Unimplemented      ErrCode = 12
	Internal           ErrCode = 13
	Unavailable        ErrCode = 14
	DataLoss           ErrCode = 15
	Unauthenticated    ErrCode = 16
	SysError           ErrCode = 10000
	DBError            ErrCode = 21000
	RowExists          ErrCode = 21001
	RedisErr           ErrCode = 22000
	IOError            ErrCode = 30000
	UploadFail         ErrCode = 30001
	UploadCheckFail    ErrCode = 30002
	UploadCheckFormat  ErrCode = 30003
	TimeTooMuch        ErrCode = 30004
	ParamInvalid       ErrCode = 30005
)

func (ErrCode) Code

func (x ErrCode) Code() int

func (ErrCode) Descriptor

func (ErrCode) Descriptor() protoreflect.EnumDescriptor

func (ErrCode) Enum

func (x ErrCode) Enum() *ErrCode

func (ErrCode) EnumDescriptor deprecated

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

Deprecated: Use ErrCode.Descriptor instead.

func (ErrCode) ErrRep

func (x ErrCode) ErrRep() *ErrRep

func (ErrCode) Error

func (x ErrCode) Error() string

func (ErrCode) GrpcStatus added in v1.2.12

func (x ErrCode) GrpcStatus() *status.Status

example 实现

func (ErrCode) MarshalGQL

func (x ErrCode) MarshalGQL(w io.Writer)

func (ErrCode) MarshalJSON added in v1.6.0

func (x ErrCode) MarshalJSON() ([]byte, error)

func (ErrCode) Message

func (x ErrCode) Message(msg string) *ErrRep

func (ErrCode) Number

func (x ErrCode) Number() protoreflect.EnumNumber

func (ErrCode) OriErrRep

func (x ErrCode) OriErrRep() *errorsi.ErrRep

func (ErrCode) OriLog

func (x ErrCode) OriLog(err error) *errorsi.ErrRep

func (ErrCode) OriMessage

func (x ErrCode) OriMessage(msg string) *errorsi.ErrRep

func (ErrCode) OriWarp

func (x ErrCode) OriWarp(err error) *errorsi.ErrRep

func (ErrCode) OrigString

func (x ErrCode) OrigString() string

func (ErrCode) Origin

func (x ErrCode) Origin() errorsi.ErrCode

func (ErrCode) Rep

func (x ErrCode) Rep() *ErrRep

func (ErrCode) String

func (x ErrCode) String() string

func (ErrCode) Type

func (ErrCode) Type() protoreflect.EnumType

func (*ErrCode) UnmarshalGQL

func (x *ErrCode) UnmarshalGQL(v interface{}) error

func (*ErrCode) UnmarshalJSON added in v1.6.0

func (x *ErrCode) UnmarshalJSON(data []byte) error

func (ErrCode) Warp

func (x ErrCode) Warp(err error) *ErrRep

type ErrCodeGeneric

type ErrCodeGeneric interface {
	~int | ~int32 | ~int64 | ~uint | ~uint32 | ~uint64
}

type ErrCodeInterface

type ErrCodeInterface interface {
}

type ErrRep

type ErrRep struct {
	Code    ErrCode `protobuf:"varint,1,opt,name=code,proto3,enum=errorcode.ErrCode" json:"code"`
	Message string  `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func FromError

func FromError(err error) (s *ErrRep, ok bool)

func NewErrRep added in v1.6.0

func NewErrRep[E ErrCodeGeneric](code E, msg string) *ErrRep

func SuccessRep added in v1.6.0

func SuccessRep() *ErrRep

func (*ErrRep) Descriptor deprecated

func (*ErrRep) Descriptor() ([]byte, []int)

Deprecated: Use ErrRep.ProtoReflect.Descriptor instead.

func (*ErrRep) Error

func (x *ErrRep) Error() string

func (*ErrRep) GetCode

func (x *ErrRep) GetCode() ErrCode

func (*ErrRep) GetMessage

func (x *ErrRep) GetMessage() string

func (*ErrRep) GrpcStatus added in v1.2.12

func (x *ErrRep) GrpcStatus() *status.Status

func (*ErrRep) MarshalJSON

func (x *ErrRep) MarshalJSON() ([]byte, error)

func (*ErrRep) ProtoMessage

func (*ErrRep) ProtoMessage()

func (*ErrRep) ProtoReflect

func (x *ErrRep) ProtoReflect() protoreflect.Message

func (*ErrRep) Reset

func (x *ErrRep) Reset()

func (*ErrRep) String

func (x *ErrRep) String() string

type ErrRepInterface

type ErrRepInterface interface {
	ErrRep() *ErrRep
}

Jump to

Keyboard shortcuts

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