exception

package
v0.0.0-...-1225d9a Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUnaryClientInterceptor

func NewUnaryClientInterceptor() grpc.UnaryClientInterceptor

grpc server端 的异常只支持 code 与 description, 为了能完整把异常传递给下游调用方, 把异常放到了grpc response header中 客户端如果发现有这个key 说明该异常是我们定义的业务异常对象(API Exception), 需要还原。

Types

type UnaryClientInterceptor

type UnaryClientInterceptor struct {
}

func (*UnaryClientInterceptor) UnaryClientInterceptor

func (e *UnaryClientInterceptor) UnaryClientInterceptor(
	ctx context.Context,
	method string,
	req, reply interface{},
	cc *grpc.ClientConn,
	invoker grpc.UnaryInvoker,
	opts ...grpc.CallOption) error

Jump to

Keyboard shortcuts

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