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) }