mirror of
https://github.com/astaxie/beego.git
synced 2024-11-23 00:30:56 +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() {
|
func (c *Controller) StopRun() {
|
||||||
panic("")
|
panic("StopRun")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) UrlFor(endpoint string, values ...string) string {
|
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) {
|
func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
|
if fmt.Sprint(err) == "StopRun" {
|
||||||
|
return
|
||||||
|
}
|
||||||
if _, ok := err.(middleware.HTTPException); ok {
|
if _, ok := err.(middleware.HTTPException); ok {
|
||||||
// catch intented errors, only for HTTP 4XX and 5XX
|
// catch intented errors, only for HTTP 4XX and 5XX
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user