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

RPC Service主动抛非strErr错误 #806

Closed marslabtron closed 1 year ago

marslabtron commented 1 year ago

smallnest你好,

我使用rpcx开发了一主多从的raft服务,client采用MultipleTcpServersDiscovery,以及Failover失败模式,我希望client在访问到从节点时触发Failover;

目前service端返回错误都被作为strErr处理掉了,不会触发Failover,针对以上需求请教有何官方的解决方案?

smallnest commented 1 year ago

客户端实现 ClientErrorFunc,请参照 https://github.com/smallnest/rpcx/commit/0f372c4f24bac89e6f72a75039e636ba2b56cd8f#diff-bd3a55a72186f59e2e63efb4951573b2f9e4a7cc98086e922b0859f8ccc1dd09

marslabtron commented 1 year ago

客户端实现 ClientErrorFunc,请参照 0f372c4#diff-bd3a55a72186f59e2e63efb4951573b2f9e4a7cc98086e922b0859f8ccc1dd09

type ServiceError interface { Error() string IsServiceError() bool }

该接口定义的IsServiceError()并没有在任何地方用到,xclient.Call中在判断失败模式中if _, ok := err.(ServiceError); ok { return error } 是否需要判断一下IsServiceError()再renturn

smallnest commented 1 year ago

rpcx需要扩展下,待我想想

smallnest commented 1 year ago

我应该fix,如果还没有修复,请reopen它