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:
parent
436f9a7468
commit
b9fdbdf7b5
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user