errorpb

package
v2.0.0-alpha.16 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

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_Unavailable        Code = 14
	Code_DataLoss           Code = 15
	Code_Unauthenticated    Code = 16
	Code_TooManyRequests    Code = 17
)

func CodeDecode

func CodeDecode(name string) Code

func (Code) Descriptor

func (Code) Descriptor() protoreflect.EnumDescriptor

func (Code) Enum

func (x Code) Enum() *Code

func (Code) EnumDescriptor deprecated

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

Deprecated: Use Code.Descriptor instead.

func (Code) Number

func (x Code) Number() protoreflect.EnumNumber

func (Code) String

func (x Code) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use ErrCode.ProtoReflect.Descriptor instead.

func (*ErrCode) GetCode

func (x *ErrCode) GetCode() int32

func (*ErrCode) GetDetails

func (x *ErrCode) GetDetails() []*anypb.Any

func (*ErrCode) GetId

func (x *ErrCode) GetId() string

func (*ErrCode) GetMessage

func (x *ErrCode) GetMessage() string

func (*ErrCode) GetName

func (x *ErrCode) GetName() string

func (*ErrCode) GetStatusCode

func (x *ErrCode) GetStatusCode() Code

func (*ErrCode) ProtoMessage

func (*ErrCode) ProtoMessage()

func (*ErrCode) ProtoReflect

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

func (*ErrCode) Reset

func (x *ErrCode) Reset()

func (*ErrCode) String

func (x *ErrCode) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use ErrMsg.ProtoReflect.Descriptor instead.

func (*ErrMsg) GetDetail

func (x *ErrMsg) GetDetail() string

func (*ErrMsg) GetId

func (x *ErrMsg) GetId() string

func (*ErrMsg) GetMsg

func (x *ErrMsg) GetMsg() string

func (*ErrMsg) GetStack

func (x *ErrMsg) GetStack() string

func (*ErrMsg) GetTags

func (x *ErrMsg) GetTags() map[string]string

func (*ErrMsg) ProtoMessage

func (*ErrMsg) ProtoMessage()

func (*ErrMsg) ProtoReflect

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

func (*ErrMsg) Reset

func (x *ErrMsg) Reset()

func (*ErrMsg) String

func (x *ErrMsg) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Fields.ProtoReflect.Descriptor instead.

func (*Fields) GetCode

func (x *Fields) GetCode() Code

func (*Fields) GetMsg

func (x *Fields) GetMsg() string

func (*Fields) GetName

func (x *Fields) GetName() string

func (*Fields) ProtoMessage

func (*Fields) ProtoMessage()

func (*Fields) ProtoReflect

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

func (*Fields) Reset

func (x *Fields) Reset()

func (*Fields) String

func (x *Fields) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Options.ProtoReflect.Descriptor instead.

func (*Options) GetDefaultCode

func (x *Options) GetDefaultCode() Code

func (*Options) GetGen

func (x *Options) GetGen() bool

func (*Options) GetName

func (x *Options) GetName() string

func (*Options) ProtoMessage

func (*Options) ProtoMessage()

func (*Options) ProtoReflect

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

func (*Options) Reset

func (x *Options) Reset()

func (*Options) String

func (x *Options) String() string

Jump to

Keyboard shortcuts

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