Merge branch 'errcode' of github.com:OpenIMSDK/Open-IM-Server into errcode

This commit is contained in:
wangchuxiao 2023-03-17 16:24:53 +08:00
commit d1c07f2e5c

View File

@ -86,3 +86,13 @@ func Unwrap(err error) error {
}
return err
}
func Wrap(err error, msg ...string) error {
if err == nil {
return nil
}
if len(msg) == 0 {
return errors.WithStack(err)
}
return errors.Wrap(err, strings.Join(msg, ", "))
}