1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 21:01:31 +00:00

use StopRun to terminate the execution

This commit is contained in:
astaxie 2013-12-16 23:22:15 +08:00
parent 436f9a7468
commit b9fdbdf7b5
2 changed files with 4 additions and 1 deletions

View File

@ -181,7 +181,7 @@ func (c *Controller) Abort(code string) {
}
func (c *Controller) StopRun() {
panic("")
panic("StopRun")
}
func (c *Controller) UrlFor(endpoint string, values ...string) string {

View File

@ -369,6 +369,9 @@ func (p *ControllerRegistor) UrlFor(endpoint string, values ...string) string {
func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
defer func() {
if err := recover(); err != nil {
if fmt.Sprint(err) == "StopRun" {
return
}
if _, ok := err.(middleware.HTTPException); ok {
// catch intented errors, only for HTTP 4XX and 5XX
} else {