优化错误处理相关代码

This commit is contained in:
刘祥超
2023-08-11 14:51:23 +08:00
parent 2eee314ec8
commit 70d8507c4b
10 changed files with 16 additions and 17 deletions

View File

@@ -5,6 +5,7 @@ package utils
import (
"errors"
"fmt"
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
executils "github.com/TeaOSLab/EdgeNode/internal/utils/exec"
"github.com/iwind/TeaGo/Tea"
@@ -156,7 +157,7 @@ WantedBy=multi-user.target`
cmd.WithStderr()
err = cmd.Run()
if err != nil {
return errors.New(err.Error() + ": " + cmd.Stderr())
return fmt.Errorf("%w: %s", err, cmd.Stderr())
}
return nil
}