Archived
优化错误处理相关代码
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package nodes
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
|
||||
@@ -141,7 +141,7 @@ func (this *ListenerManager) Start(nodeConfig *nodeconfigs.NodeConfig) error {
|
||||
var port = addr[portIndex+1:]
|
||||
var processName = this.findProcessNameWithPort(group.IsUDP(), port)
|
||||
if len(processName) > 0 {
|
||||
err = errors.New(err.Error() + " (the process using port: '" + processName + "')")
|
||||
err = fmt.Errorf("%w (the process using port: '%s')", err, processName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ func (this *Node) syncConfig(taskVersion int64) error {
|
||||
if os.IsNotExist(clusterErr) {
|
||||
return errors.New("can not find config file 'configs/api.yaml'")
|
||||
}
|
||||
return errors.New("check cluster config failed: " + clusterErr.Error())
|
||||
return fmt.Errorf("check cluster config failed: %w", clusterErr)
|
||||
}
|
||||
} else {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user