优化错误处理相关代码

This commit is contained in:
GoEdgeLab
2023-08-11 16:13:33 +08:00
parent 310bc107ad
commit 16557ba6d7
19 changed files with 81 additions and 68 deletions

View File

@@ -2,6 +2,7 @@ package rpcutils
import (
"errors"
"fmt"
)
type UserType = string
@@ -27,5 +28,5 @@ func Wrap(description string, err error) error {
if err == nil {
return errors.New(description)
}
return errors.New(description + ": " + err.Error())
return fmt.Errorf("%s: %w", description, err)
}