Copilot commented on code in PR #996:
URL: https://github.com/apache/dubbo-go-pixiu/pull/996#discussion_r3480480407
##########
pkg/filter/network/dubboproxy/plugin.go:
##########
@@ -45,10 +47,10 @@ func (p *Plugin) Kind() string {
// CreateFilter create dubbo networkfilter
func (p *Plugin) CreateFilter(config any) (filter.NetworkFilter, error) {
hcmc, ok := config.(*model.DubboProxyConnectionManagerConfig)
- hcmc.Timeout = stringutil.ResolveTimeStr2Time(hcmc.TimeoutStr,
constant.DefaultReqTimeout)
if !ok {
- panic("CreateFilter occur some exception for the type is not
suitable one.")
+ return nil, fmt.Errorf("CreateFilter occur some exception for
the type is not suitable one. expected
*model.DubboProxyConnectionManagerConfig, got %T", config)
Review Comment:
The new error message is verbose/awkward (“occur some exception… type is not
suitable one”) and makes logs harder to read. Consider switching to a concise,
idiomatic type-mismatch message while keeping the useful %T detail.
##########
pkg/filter/network/dubboproxy/manager.go:
##########
@@ -144,7 +144,7 @@ func (dcm *DubboProxyConnectionManager) OnTripleData(ctx
context.Context, method
func (dcm *DubboProxyConnectionManager) OnData(data any) (any, error) {
old_invoc, ok := data.(*invocation.RPCInvocation)
if !ok {
- panic("create invocation occur some exception for the type is
not suitable one.")
+ return nil, errors.Errorf("create invocation occur some
exception for the type is not suitable one. expected *invocation.RPCInvocation,
got %T", data)
Review Comment:
The new error message is verbose/awkward (“create invocation occur some
exception… type is not suitable one”). A shorter, specific type-mismatch
message is easier to scan in logs while preserving the expected/actual types.
--
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]