ecode

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const EcodeNum int32 = 9999

EcodeNum 低于10000均为系统错误码,业务错误码请使用10000以上

Variables

View Source
var (
	// OK ...
	OK = &SpbStatus{
		&spb.Status{
			Code:    int32(codes.OK),
			Message: "OK",
			Details: make([]*any.Any, 0),
		},
	}
)

Functions

This section is empty.

Types

type SpbStatus added in v0.4.0

type SpbStatus struct {
	*spb.Status
}

SpbStatus ...

func ExtractCodes

func ExtractCodes(e error) *SpbStatus

ExtractCodes cause from error to ecode.

func (*SpbStatus) CauseCode added in v0.4.0

func (s *SpbStatus) CauseCode() int

CauseCode ...

func (*SpbStatus) GetCodeAsBool added in v0.4.0

func (s *SpbStatus) GetCodeAsBool() bool

GetCodeAsBool ...

func (*SpbStatus) GetCodeAsInt added in v0.4.0

func (s *SpbStatus) GetCodeAsInt() int

GetCodeAsInt ...

func (*SpbStatus) GetCodeAsUint32 added in v0.4.0

func (s *SpbStatus) GetCodeAsUint32() uint32

GetCodeAsUint32 ...

func (*SpbStatus) GetDetailMessage added in v0.4.0

func (s *SpbStatus) GetDetailMessage(exts ...interface{}) string

GetDetailMessage ...

func (*SpbStatus) GetMessage added in v0.4.0

func (s *SpbStatus) GetMessage(exts ...interface{}) string

GetMessage ...

func (*SpbStatus) MustWithDetails added in v0.4.0

func (s *SpbStatus) MustWithDetails(details ...interface{}) *SpbStatus

MustWithDetails ...

func (*SpbStatus) Proto added in v0.4.0

func (s *SpbStatus) Proto() *spb.Status

Proto ...

func (*SpbStatus) String added in v0.4.0

func (s *SpbStatus) String() string

String ...

func (*SpbStatus) WithDetails added in v0.4.0

func (s *SpbStatus) WithDetails(details ...interface{}) (*SpbStatus, error)

WithDetails returns a new status with the provided details messages appended to the status. If any errors are encountered, it returns nil and the first error encountered.

type Status

type Status interface {
}

Status ...

Jump to

Keyboard shortcuts

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