We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b654ad3 commit 48e52edCopy full SHA for 48e52ed
drivers/goframe/web/gf.go
@@ -12,6 +12,7 @@ import (
12
"github.com/glennliao/apijson-go/consts"
13
"github.com/glennliao/apijson-go/model"
14
"github.com/gogf/gf/v2/container/gmap"
15
+ "github.com/gogf/gf/v2/errors/gcode"
16
"github.com/gogf/gf/v2/errors/gerror"
17
"github.com/gogf/gf/v2/frame/g"
18
"github.com/gogf/gf/v2/net/ghttp"
@@ -159,6 +160,16 @@ func CommonResponse(handler func(ctx context.Context, req model.Map) (res model.
159
160
code = 500
161
msg = "系统异常"
162
}
163
+ }
164
+
165
+ if e, ok := err.(*gerror.Error); ok {
166
+ if e.Code() == gcode.CodeNil {
167
+ code = 400
168
+ msg = e.Error()
169
+ } else {
170
+ code = 500
171
+ msg = "系统异常"
172
173
} else {
174
175
0 commit comments