Documentation
¶
Index ¶
- Variables
- func CodeValues() []string
- type Code
- type ErrCode
- func (*ErrCode) Descriptor() ([]byte, []int)deprecated
- func (x *ErrCode) GetCode() int32
- func (x *ErrCode) GetDetails() []*anypb.Any
- func (x *ErrCode) GetId() string
- func (x *ErrCode) GetMessage() string
- func (x *ErrCode) GetName() string
- func (x *ErrCode) GetStatusCode() Code
- func (*ErrCode) ProtoMessage()
- func (x *ErrCode) ProtoReflect() protoreflect.Message
- func (x *ErrCode) Reset()
- func (x *ErrCode) String() string
- type ErrMsg
- func (*ErrMsg) Descriptor() ([]byte, []int)deprecated
- func (x *ErrMsg) GetDetail() string
- func (x *ErrMsg) GetId() string
- func (x *ErrMsg) GetMsg() string
- func (x *ErrMsg) GetStack() string
- func (x *ErrMsg) GetTags() map[string]string
- func (*ErrMsg) ProtoMessage()
- func (x *ErrMsg) ProtoReflect() protoreflect.Message
- func (x *ErrMsg) Reset()
- func (x *ErrMsg) String() string
- type Fields
- type Options
- func (*Options) Descriptor() ([]byte, []int)deprecated
- func (x *Options) GetDefaultCode() Code
- func (x *Options) GetGen() bool
- func (x *Options) GetName() string
- func (*Options) ProtoMessage()
- func (x *Options) ProtoReflect() protoreflect.Message
- func (x *Options) Reset()
- func (x *Options) String() string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Code_name = map[int32]string{ 0: "OK", 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", 17: "TooManyRequests", } Code_value = map[string]int32{ "OK": 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, "TooManyRequests": 17, } )
Enum value maps for Code.
View Source
var (
// optional errors.Fields field = 100002;
E_Field = &file_errorpb_options_proto_extTypes[0]
)
Extension fields to descriptorpb.EnumValueOptions.
View Source
var (
// optional errors.Options opts = 100001;
E_Opts = &file_errorpb_options_proto_extTypes[1]
)
Extension fields to descriptorpb.EnumOptions.
View Source
var File_errorpb_code_proto protoreflect.FileDescriptor
View Source
var File_errorpb_errors_proto protoreflect.FileDescriptor
View Source
var File_errorpb_options_proto protoreflect.FileDescriptor
Functions ¶
func CodeValues ¶
func CodeValues() []string
Types ¶
type Code ¶
type Code int32
const ( Code_OK Code = 0 Code_Canceled Code = 1 Code_Unknown Code = 2 Code_InvalidArgument Code = 3 Code_DeadlineExceeded Code = 4 Code_NotFound Code = 5 Code_AlreadyExists Code = 6 Code_PermissionDenied Code = 7 Code_ResourceExhausted Code = 8 Code_FailedPrecondition Code = 9 Code_Aborted Code = 10 Code_OutOfRange Code = 11 Code_Unimplemented Code = 12 Code_Internal Code = 13 Code_DataLoss Code = 15 Code_Unauthenticated Code = 16 Code_TooManyRequests Code = 17 )
func CodeDecode ¶
func (Code) Descriptor ¶
func (Code) Descriptor() protoreflect.EnumDescriptor
func (Code) EnumDescriptor
deprecated
func (Code) Number ¶
func (x Code) Number() protoreflect.EnumNumber
func (Code) Type ¶
func (Code) Type() protoreflect.EnumType
type ErrCode ¶
type ErrCode struct {
// GRPC code corresponding to HTTP status code, which can be converted to each
// other
StatusCode Code `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3,enum=errors.Code" json:"status_code,omitempty"`
// Business Code, e.g. 200001
Code int32 `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"`
// Error name, e.g. lava.v1.err_code.auth_token_not_found
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
// Error message, e.g. token not found
Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"`
// Error detail include request or other user defined information
Details []*anypb.Any `protobuf:"bytes,5,rep,name=details,proto3" json:"details,omitempty"`
// Error id, which can be used to trace error
Id *string `protobuf:"bytes,6,opt,name=id,proto3,oneof" json:"id,omitempty"`
// contains filtered or unexported fields
}
func (*ErrCode) Descriptor
deprecated
func (*ErrCode) GetDetails ¶
func (*ErrCode) GetMessage ¶
func (*ErrCode) GetStatusCode ¶
func (*ErrCode) ProtoMessage ¶
func (*ErrCode) ProtoMessage()
func (*ErrCode) ProtoReflect ¶
func (x *ErrCode) ProtoReflect() protoreflect.Message
type ErrMsg ¶
type ErrMsg struct {
Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
Detail string `protobuf:"bytes,2,opt,name=detail,proto3" json:"detail,omitempty"`
Stack string `protobuf:"bytes,3,opt,name=stack,proto3" json:"stack,omitempty"`
Tags map[string]string `` /* 149-byte string literal not displayed */
Id *string `protobuf:"bytes,5,opt,name=id,proto3,oneof" json:"id,omitempty"`
// contains filtered or unexported fields
}
func (*ErrMsg) Descriptor
deprecated
func (*ErrMsg) ProtoMessage ¶
func (*ErrMsg) ProtoMessage()
func (*ErrMsg) ProtoReflect ¶
func (x *ErrMsg) ProtoReflect() protoreflect.Message
type Fields ¶
type Fields struct {
Code Code `protobuf:"varint,1,opt,name=code,proto3,enum=errors.Code" json:"code,omitempty"`
Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
// contains filtered or unexported fields
}
func (*Fields) Descriptor
deprecated
func (*Fields) ProtoMessage ¶
func (*Fields) ProtoMessage()
func (*Fields) ProtoReflect ¶
func (x *Fields) ProtoReflect() protoreflect.Message
type Options ¶
type Options struct {
// gen 是否生成 error code
Gen bool `protobuf:"varint,1,opt,name=gen,proto3" json:"gen,omitempty"`
// default_code 默认的 error code, 可能是 Internal
DefaultCode Code `protobuf:"varint,2,opt,name=default_code,json=defaultCode,proto3,enum=errors.Code" json:"default_code,omitempty"`
// name 是生成的 error code 的变量名前缀
// 如果 name = Test, 那么 生成的 error code 变量名可能为 `TestErrCodeNotFound`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
// contains filtered or unexported fields
}
func (*Options) Descriptor
deprecated
func (*Options) GetDefaultCode ¶
func (*Options) ProtoMessage ¶
func (*Options) ProtoMessage()
func (*Options) ProtoReflect ¶
func (x *Options) ProtoReflect() protoreflect.Message
Click to show internal directories.
Click to hide internal directories.