From 61a115852ed74ec6e7b176539ac05992af6ddb62 Mon Sep 17 00:00:00 2001 From: zhaoyupeng Date: Wed, 23 Jul 2025 10:32:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20resp=20RE=20?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E6=97=B6=20error=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resp/resp.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resp/resp.go b/resp/resp.go index d05bdfa..097ceb1 100644 --- a/resp/resp.go +++ b/resp/resp.go @@ -68,11 +68,7 @@ H4: r.Code = code } H3: - if es, ok := args[2].(error); ok { - r.Err = es.Error() - } else { - r.Err = args[2] - } + r.Err = args[2] H2: r.Data = args[1] H1: @@ -86,6 +82,10 @@ END: r.Msg = Msg(r.Status) } + if ce, ok := r.Err.(error); ok { + r.Err = ce.Error() + } + c.AbortWithStatusJSON(r.Status, r) }