bizerr

package
v1.0.37 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCodeUnknown  = ErrCodeModuleRoot + iota // unknown error code
	ErrCodeInternal                            // internal error
)

define common error code

View Source
const (
	ErrCodeModuleRoot = ErrCodeStart * (1 + iota)
)

ErrCodeModuleRoot define error code module, e,g: 10000, 20000, 30000...

View Source
const ErrCodeStart = 10000

ErrCodeStart 业务逻辑错误代码开始值

Variables

View Source
var (
	ErrInvalidLengthErr        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowErr          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupErr = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type BizError

type BizError struct {
	Code int32  `json:"code"`
	Msg  string `json:"msg"`
}

func Convert

func Convert(err error) *BizError

Convert 从grpc status error获取额外的错误信息

func New

func New(code int32, message string) *BizError

New an error support error code

func (BizError) Error

func (be BizError) Error() string

type Error

type Error struct {
	Code int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Msg  string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
}

func (*Error) Descriptor

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

func (*Error) GetCode

func (m *Error) GetCode() int32

func (*Error) GetMsg

func (m *Error) GetMsg() string

func (*Error) Marshal

func (m *Error) Marshal() (dAtA []byte, err error)

func (*Error) MarshalTo

func (m *Error) MarshalTo(dAtA []byte) (int, error)

func (*Error) MarshalToSizedBuffer

func (m *Error) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) Reset

func (m *Error) Reset()

func (*Error) Size

func (m *Error) Size() (n int)

func (*Error) String

func (m *Error) String() string

func (*Error) Unmarshal

func (m *Error) Unmarshal(dAtA []byte) error

func (*Error) XXX_DiscardUnknown

func (m *Error) XXX_DiscardUnknown()

func (*Error) XXX_Marshal

func (m *Error) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Error) XXX_Merge

func (m *Error) XXX_Merge(src proto.Message)

func (*Error) XXX_Size

func (m *Error) XXX_Size() int

func (*Error) XXX_Unmarshal

func (m *Error) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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