1f1190fb by astaxie

Merge pull request #738 from smallfish/master

Add CustomAbort() for Controller, support status code and body
2 parents 289f050c 20463fa7
...@@ -274,6 +274,11 @@ func (c *Controller) Abort(code string) { ...@@ -274,6 +274,11 @@ func (c *Controller) Abort(code string) {
274 } 274 }
275 } 275 }
276 276
277 // CustomAbort stops controller handler and show the error data, it's similar Aborts, but support status code and body.
278 func (c *Controller) CustomAbort(status int, body string) {
279 c.Ctx.Abort(status, body)
280 }
281
277 // StopRun makes panic of USERSTOPRUN error and go to recover function if defined. 282 // StopRun makes panic of USERSTOPRUN error and go to recover function if defined.
278 func (c *Controller) StopRun() { 283 func (c *Controller) StopRun() {
279 panic(USERSTOPRUN) 284 panic(USERSTOPRUN)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!