gerrx

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: MIT Imports: 5 Imported by: 0

README

GRPC错误堆栈打印

快速开始

go get github.com/bobzh39/errx/gerrx

// 定义默认code为 codes.Internal
errx.Config.DefaultGRPCCode = uint32(codes.Internal)
// 加载使用GRPC error工厂
gerrx.LoadGRPCError()

更多使用方式参考errx

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadGRPCError

func LoadGRPCError()

LoadGRPCError 使用GRPC error

func WithGRPCCode

func WithGRPCCode(code codes.Code) errx.Option

WithGRPCCode set a custom grpc code if the st is a GRPCError

Types

type GRPCError

type GRPCError interface {
	errx.StackTraceError
	// GRPCCode return a GRPCCode
	GRPCCode() codes.Code
	SetGRPCCode(code codes.Code)
}

GRPCError grpc code interface

type GRPCStackTraceError

type GRPCStackTraceError struct {
	*errx.DefaultStackTraceError
	// contains filtered or unexported fields
}

GRPCStackTraceError grpc error

func (*GRPCStackTraceError) GRPCCode

func (g *GRPCStackTraceError) GRPCCode() codes.Code

func (*GRPCStackTraceError) GRPCStatus

func (g *GRPCStackTraceError) GRPCStatus() *status.Status

GRPCStatus grpc status code返回

func (*GRPCStackTraceError) SetGRPCCode

func (g *GRPCStackTraceError) SetGRPCCode(code codes.Code)

Jump to

Keyboard shortcuts

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