b9fdbdf7 by astaxie

use StopRun to terminate the execution

1 parent 436f9a74
...@@ -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 {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!