自定义错误展示
type MyError struct {
Code int
Message string
}
func NewMyError(code int, message string) *MyError {
return &MyError{Code: code, Message: message}
}
func (this *IndexClass) Test(ctx *gin.Context) goft.Json {
ctx.Set(goft.HTTP_STATUS, 503) //这里是控制httpcode,默认400
panic(NewMyError(1800, "oh shit"))
return NewDataModel(101, "wfew")
}最后更新于