Skip to content

Commit

Permalink
fix: super 包优化 GetError 函数的空指针问题
Browse files Browse the repository at this point in the history
  • Loading branch information
kercylan98 committed Sep 19, 2023
1 parent f7b91eb commit ab3926e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions utils/super/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ab3926e

Please sign in to comment.