Merge remote-tracking branch 'origin/errcode' into errcode

# Conflicts:
#	internal/rpc/msg/delete.go
#	pkg/common/db/controller/msg.go
#	pkg/common/db/table/unrelation/extend_msg_set.go
This commit is contained in:
wangchuxiao
2023-02-23 19:17:23 +08:00
12 changed files with 652 additions and 217 deletions
+21
View File
@@ -21,6 +21,27 @@ func CopyStructFields(a interface{}, b interface{}, fields ...string) (err error
return copier.Copy(a, b)
}
func Wrap1(err error) error {
if err != nil {
return Wrap(err, "")
}
return nil
}
func Wrap2[T any](a T, err error) (T, error) {
if err != nil {
return a, Wrap(err, "")
}
return a, nil
}
func Wrap3[T any, V any](a T, b V, err error) (T, V, error) {
if err != nil {
return a, b, Wrap(err, "")
}
return a, b, nil
}
func Wrap(err error, message string) error {
return errors.Wrap(err, "==> "+printCallerNameAndLine()+message)
}