Commit 7b27b7fe authored by astaxie's avatar astaxie

change SopRun to a variable

parent 3a996c13
......@@ -24,6 +24,10 @@ import (
"github.com/astaxie/beego/session"
)
var (
USERSTOPRUN = errors.New("User stop run")
)
type Controller struct {
Ctx *context.Context
Data map[interface{}]interface{}
......@@ -181,7 +185,7 @@ func (c *Controller) Abort(code string) {
}
func (c *Controller) StopRun() {
panic("StopRun")
panic(USERSTOPRUN)
}
func (c *Controller) UrlFor(endpoint string, values ...string) string {
......
......@@ -369,7 +369,7 @@ 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" {
if err == USERSTOPRUN {
return
}
if _, ok := err.(middleware.HTTPException); ok {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment