errors

package
v0.2.10-2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert added in v0.1.16

func Convert(err error) *status.Status

Convert 内部转换,为了让err=nil的时候,监控数据里有OK信息

func Err2GrpcCode

func Err2GrpcCode(err error) codes.Code

Err2GrpcCode converts a standard Go error into its canonical code. Note that this is only used to translate the error returned by the server applications.

func GrpcCodeToHTTP

func GrpcCodeToHTTP(statusCode codes.Code) int

GrpcCodeToHTTP gRPC转HTTP Code

func Http2GrpcCode

func Http2GrpcCode(code int32) codes.Code

func IsGrpcAcceptable

func IsGrpcAcceptable(err error) bool

func IsMemoryErr

func IsMemoryErr(err error) bool

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

func FromError

func FromError(err error) *Error

FromError try to convert an error to *Error. It supports wrapped errors.

func New

func New(code string) *Error

New generates a custom error.

func (*Error) As

func (e *Error) As(target interface{}) bool

func (*Error) Ctx

func (e *Error) Ctx(ctx context.Context) *Error

Ctx get some metadata from ctx

func (*Error) Err

func (e *Error) Err(err error) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) GRPCStatus added in v0.1.16

func (e *Error) GRPCStatus() *status.Status

GRPCStatus 实现grpc status的GRPCStatus接口

func (*Error) HTTPStatus

func (e *Error) HTTPStatus() int

HTTPStatus returns the Status represented by se.

func (*Error) Is

func (e *Error) Is(err error) bool

Is matches each error in the chain with the target value.

func (*Error) Msg

func (e *Error) Msg(msg string, args ...interface{}) *Error

func (*Error) Status

func (e *Error) Status(code codes.Code) *Error

func (*Error) StatusAborted

func (e *Error) StatusAborted() error

func (*Error) StatusAlreadyExists

func (e *Error) StatusAlreadyExists() error

func (*Error) StatusBadRequest

func (e *Error) StatusBadRequest() error

func (*Error) StatusCancelled

func (e *Error) StatusCancelled() error

func (*Error) StatusConflict

func (e *Error) StatusConflict() error

func (*Error) StatusDataLoss

func (e *Error) StatusDataLoss() error

func (*Error) StatusDeadlineExceeded

func (e *Error) StatusDeadlineExceeded() error

func (*Error) StatusFailedPrecondition

func (e *Error) StatusFailedPrecondition() error

func (*Error) StatusForbidden

func (e *Error) StatusForbidden() error

func (*Error) StatusInternal

func (e *Error) StatusInternal() error

func (*Error) StatusInvalidArgument

func (e *Error) StatusInvalidArgument() error

func (*Error) StatusNotFound

func (e *Error) StatusNotFound() error

func (*Error) StatusOutOfRange

func (e *Error) StatusOutOfRange() error

func (*Error) StatusPermissionDenied

func (e *Error) StatusPermissionDenied() error

func (*Error) StatusResourceExhausted

func (e *Error) StatusResourceExhausted() error

func (*Error) StatusTimeout

func (e *Error) StatusTimeout() error

func (*Error) StatusUnauthorized

func (e *Error) StatusUnauthorized() error

func (*Error) StatusUnavailable

func (e *Error) StatusUnavailable() error

func (*Error) StatusUnimplemented

func (e *Error) StatusUnimplemented() error

func (*Error) StatusUnknown

func (e *Error) StatusUnknown() error

func (*Error) Tag

func (e *Error) Tag(k, v string) *Error

func (*Error) TraceId

func (e *Error) TraceId(traceId string) *Error

Jump to

Keyboard shortcuts

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