Merge pull request #738 from smallfish/master
Add CustomAbort() for Controller, support status code and body
Showing
1 changed file
with
5 additions
and
0 deletions
| ... | @@ -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) | ... | ... |
-
Please register or sign in to post a comment