errors

package
v0.0.0-...-da4b49c Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: BSD-3-Clause Imports: 14 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_errors_proto protoreflect.FileDescriptor

Functions

func CheckErrorByCode

func CheckErrorByCode(err error, code int32) bool

func HTTPError

func HTTPError(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, req *http.Request, err error)

func New

func New(httpStatus int32, grpcStatus codes.Code, code int32, message string, otherErrors ...*ErrorDetail) error

func NewGeneralError400

func NewGeneralError400(errorMessage string) error

func NewGeneralError500

func NewGeneralError500(errorMessage string) error

Types

type Error

type Error struct {
	HTTPStatus  int32          `protobuf:"varint,1,opt,name=HTTPStatus,json=http_status,proto3" json:"HTTPStatus,omitempty"`
	GRPCStatus  int32          `protobuf:"varint,2,opt,name=GRPCStatus,json=grpc_status,proto3" json:"GRPCStatus,omitempty"`
	Code        int32          `protobuf:"varint,3,opt,name=Code,json=code,proto3" json:"Code,omitempty"`
	Message     string         `protobuf:"bytes,4,opt,name=Message,json=message,proto3" json:"Message,omitempty"`
	OtherErrors []*ErrorDetail `protobuf:"bytes,5,rep,name=OtherErrors,json=other_errors,proto3" json:"OtherErrors,omitempty"`
	// contains filtered or unexported fields
}

func NewFromError

func NewFromError(err error) (*Error, error)

func (*Error) Descriptor deprecated

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

Deprecated: Use Error.ProtoReflect.Descriptor instead.

func (*Error) GetCode

func (x *Error) GetCode() int32

func (*Error) GetGRPCStatus

func (x *Error) GetGRPCStatus() int32

func (*Error) GetHTTPStatus

func (x *Error) GetHTTPStatus() int32

func (*Error) GetMessage

func (x *Error) GetMessage() string

func (*Error) GetOtherErrors

func (x *Error) GetOtherErrors() []*ErrorDetail

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) ProtoReflect

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

func (*Error) Reset

func (x *Error) Reset()

func (*Error) String

func (x *Error) String() string

type ErrorDetail

type ErrorDetail struct {
	Code    int32  `protobuf:"varint,1,opt,name=Code,json=code,proto3" json:"Code,omitempty"`
	Field   string `protobuf:"bytes,2,opt,name=Field,json=field,proto3" json:"Field,omitempty"`
	Message string `protobuf:"bytes,3,opt,name=Message,json=message,proto3" json:"Message,omitempty"`
	// contains filtered or unexported fields
}

func (*ErrorDetail) Descriptor deprecated

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

Deprecated: Use ErrorDetail.ProtoReflect.Descriptor instead.

func (*ErrorDetail) GetCode

func (x *ErrorDetail) GetCode() int32

func (*ErrorDetail) GetField

func (x *ErrorDetail) GetField() string

func (*ErrorDetail) GetMessage

func (x *ErrorDetail) GetMessage() string

func (*ErrorDetail) ProtoMessage

func (*ErrorDetail) ProtoMessage()

func (*ErrorDetail) ProtoReflect

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

func (*ErrorDetail) Reset

func (x *ErrorDetail) Reset()

func (*ErrorDetail) String

func (x *ErrorDetail) String() string

Jump to

Keyboard shortcuts

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