1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 10:50:55 +00:00

Add CustomAbort() for Controller, support status code and body

This commit is contained in:
smallfish 2014-08-13 17:26:22 +08:00
parent 289f050c04
commit 20463fa725

View File

@ -274,6 +274,11 @@ func (c *Controller) Abort(code string) {
} }
} }
// CustomAbort stops controller handler and show the error data, it's similar Aborts, but support status code and body.
func (c *Controller) CustomAbort(status int, body string) {
c.Ctx.Abort(status, body)
}
// StopRun makes panic of USERSTOPRUN error and go to recover function if defined. // StopRun makes panic of USERSTOPRUN error and go to recover function if defined.
func (c *Controller) StopRun() { func (c *Controller) StopRun() {
panic(USERSTOPRUN) panic(USERSTOPRUN)