use StopRun to terminate the execution
Showing
2 changed files
with
4 additions
and
1 deletions
| ... | @@ -181,7 +181,7 @@ func (c *Controller) Abort(code string) { | ... | @@ -181,7 +181,7 @@ func (c *Controller) Abort(code string) { |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | func (c *Controller) StopRun() { | 183 | func (c *Controller) StopRun() { |
| 184 | panic("") | 184 | panic("StopRun") |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | func (c *Controller) UrlFor(endpoint string, values ...string) string { | 187 | func (c *Controller) UrlFor(endpoint string, values ...string) string { | ... | ... |
| ... | @@ -369,6 +369,9 @@ func (p *ControllerRegistor) UrlFor(endpoint string, values ...string) string { | ... | @@ -369,6 +369,9 @@ func (p *ControllerRegistor) UrlFor(endpoint string, values ...string) string { |
| 369 | func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) { | 369 | func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) { |
| 370 | defer func() { | 370 | defer func() { |
| 371 | if err := recover(); err != nil { | 371 | if err := recover(); err != nil { |
| 372 | if fmt.Sprint(err) == "StopRun" { | ||
| 373 | return | ||
| 374 | } | ||
| 372 | if _, ok := err.(middleware.HTTPException); ok { | 375 | if _, ok := err.(middleware.HTTPException); ok { |
| 373 | // catch intented errors, only for HTTP 4XX and 5XX | 376 | // catch intented errors, only for HTTP 4XX and 5XX |
| 374 | } else { | 377 | } else { | ... | ... |
-
Please register or sign in to post a comment