tangerineyu commented on code in PR #3665:
URL: https://github.com/apache/dubbo-go/pull/3665#discussion_r3790751586
##########
metrics/rpc/error_classifier.go:
##########
@@ -112,6 +118,12 @@ func classifyError(err error) ErrorType {
if err == nil {
return ErrorTypeUnknown
}
+ // A typed nil *triple_protocol.Error escapes err == nil, but CodeOf
+ // would panic while dereferencing it, so return ErrorTypeUnknown
instead.
+ var tripleErr *triple_protocol.Error
+ if errors.As(err, &tripleErr) && tripleErr == nil {
+ return ErrorTypeUnknown
+ }
Review Comment:
谢谢review, 已按建议把检查移进了 CodeOf, 没有用AsType, 这个是1.26的新增api, 目前go.mod还是1.25
我沿用了asError, 只是加了一个nil判断
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]