fix: super 包优化 GetError 函数的空指针问题

This commit is contained in:
kercylan98 2023-09-19 12:33:16 +08:00
parent f7b91eb893
commit ab3926e307
1 changed files with 3 additions and 0 deletions

View File

@ -42,6 +42,9 @@ func RegErrorRef(code int, message string, ref error) error {
// GetError 通过错误引用获取错误码和真实错误信息,如果错误不存在则返回 0如果错误引用不存在则返回原本的错误
func GetError(err error) (int, error) {
if errorManagerInstance == nil {
return 0, err
}
unw := errors.Unwrap(err)
if unw == nil {
unw = err