AlexStocks commented on code in PR #3059:
URL: https://github.com/apache/dubbo-go/pull/3059#discussion_r2461086748
##########
config_center/nacos/impl.go:
##########
Review Comment:
```go
// GetRule retrieves a router rule from Nacos configuration center.
func (n *nacosDynamicConfiguration) GetRule(key string, opts
...config_center.Option) (string, error) {
tmpOpts := config_center.NewOptions(opts...)
group := n.resolvedGroup(tmpOpts.Center.Group)
content, err := n.client.Client().GetConfig(vo.ConfigParam{
DataId: key,
Group: group,
})
if err == nil {
return content, nil
}
// Handle "config not exist" gracefully (normal during initialization)
if errors.Is(err, constant.ErrConfigNotFound) ||
isConfigNotExistErr(err) {
logger.Warnf("config not found, key=%s, group=%s, err=%v", key,
group, err)
return "", nil
}
// Other unexpected errors
logger.Errorf("failed to query rule, key=%s, group=%s, err=%+v", key,
group, err)
return "", perrors.WithStack(err)
}
// isConfigNotExistErr is a helper to handle legacy SDKs that return
string-based errors.
func isConfigNotExistErr(err error) bool {
return err != nil && strings.Contains(strings.ToLower(err.Error()),
"config data not exist")
}
```
改成上面的代码
--
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]