errors

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InternalError = "service internal error"
)

Variables

This section is empty.

Functions

func Convert

func Convert(err error) *status.Status

func ServerErrorInterceptor

func ServerErrorInterceptor(ctx context.Context, req interface{},
	info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

ServerErrorInterceptor transfer a error to status error

func ServiceErr2GRPCErr

func ServiceErr2GRPCErr(err error) error

ServiceErr2GRPCErr serviceErr covert to GRPCErr

Types

type Error

type Error struct {
	Code codes.Code
	Err  error
}

func NewInternalError added in v0.0.4

func NewInternalError() *Error

func NewServiceErr

func NewServiceErr(code codes.Code, err error) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Format

func (e *Error) Format(s fmt.State, verb rune)

Jump to

Keyboard shortcuts

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