http错误判断修改

master
nikkiing 2 years ago
parent 768753b0e8
commit 51741f39ea
  1. 2
      transport/v1/http/codec.go

@ -44,7 +44,7 @@ func ResponseEncoder(w stdhttp.ResponseWriter, r *stdhttp.Request, v interface{}
func ErrorEncoderPro(w stdhttp.ResponseWriter, r *stdhttp.Request, err error) { func ErrorEncoderPro(w stdhttp.ResponseWriter, r *stdhttp.Request, err error) {
se := errors.FromError(err) se := errors.FromError(err)
if !errors.Is(err, &errors.Error{}) { if _, ok := err.(*errors.Error); !ok {
se.Reason = "InternalServerError" se.Reason = "InternalServerError"
se.Code = stdhttp.StatusInternalServerError se.Code = stdhttp.StatusInternalServerError
se.Message = "internal server error" se.Message = "internal server error"

Loading…
Cancel
Save