package middleware

import (
	"github.com/gogf/gf/v2/errors/gerror"
	"github.com/gogf/gf/v2/net/ghttp"
)

func Exit(r *ghttp.Request, err error) {
	r.Response.WriteJsonExit(ghttp.DefaultHandlerResponse{
		Code:    gerror.Code(err).Code(),
		Message: gerror.Code(err).Message(),
		Data:    nil,
	})
}
