我们应该使用拦截器在GRPC客户端中进行错误处理吗?
我有一个ASP.NET Core 6 WebAPI,该WebAPI将GRPC调用到GRPC服务。
我想实现错误处理,以便它过滤敏感信息,并在发生错误时仅返回有用的数据。
来自 - 我知道在 grpc服务器上拦截器是唯一的方法捕获GRPC错误。
但是,在客户端上,任何rpcexception都将被所述的一般例外柄抓住,如 shere 。
我看到有一个示例此处用于客户端拦截器。
但是,由于我不需要记录每个呼叫 - 出于我的目的,我没有意义。
有人看到使用拦截器在 grpc客户端上捕获错误的理由吗?
I have an Asp.Net Core 6 WebApi which makes gRPC calls to a Grpc Service.
I want to implement error handling so that it filters out sensitive information and returns only useful data when an error occurs.
From the documentation - I understand that on the Grpc Server an Interceptor is the only way to catch a gRPC error.
On the client, however, any RpcException will be caught by the general exception handers as described here.
I see there is an example here for Client side interceptor.
But since I don't need to log every call - I see no point in it for my purposes.
Does anyone see a reason to use an Interceptor to catch errors on the Grpc Client?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论