Err support nil

This commit is contained in:
Star 2025-07-19 17:46:35 +08:00
parent 1a7cdbad3f
commit 77e7e7d3fb

View File

@ -105,6 +105,9 @@ func Errf(format string, args ...any) *common.GoErr {
} }
func Err(err any) *common.GoErr { func Err(err any) *common.GoErr {
if err == nil {
return nil
}
errStr := "" errStr := ""
if e, ok := err.(error); ok { if e, ok := err.(error); ok {
errStr = e.Error() errStr = e.Error()