[feat] 添加 http 响应错误日志

This commit is contained in:
what 2024-07-04 15:50:56 +08:00
parent 692e59e54e
commit 7528e3923f

View File

@ -2,6 +2,7 @@ package contracts
import ( import (
"errors" "errors"
"log"
"github.com/samber/lo" "github.com/samber/lo"
) )
@ -25,6 +26,8 @@ type Err struct {
} }
func (err Err) Error() string { func (err Err) Error() string {
defer log.Println(err.Code, err.Msg, err.Errord)
return lo.Ternary(err.alert && err.Errord != "", err.Errord, err.Msg) return lo.Ternary(err.alert && err.Errord != "", err.Errord, err.Msg)
} }