smallnest / rpcx

Best microservices framework in Go, like alibaba Dubbo, but with more features, Scale easily. Try it. Test it. If you feel it's better, use it! 𝐉𝐚𝐯𝐚有𝐝𝐮𝐛𝐛𝐨, 𝐆𝐨𝐥𝐚𝐧𝐠有𝐫𝐩𝐜𝐱! build for cloud!
https://rpcx.io
Other
8.11k stars 1.17k forks source link

如何处理自定义error #805

Closed westwin closed 1 year ago

westwin commented 1 year ago

假定自定义error类型为 type BizErr struct { Code, Message string }

rpcx服务端,业务代码实现时会抛出BizError, 那么客户端调用时怎么能够得到BizErr类型的error呢?

有没有类似于自定义error handler之类的机制? 谢谢

smallnest commented 1 year ago

自定义error的例子: https://github.com/rpcxio/rpcx-examples/tree/master/error_customized