mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 18:00:55 +00:00
change SopRun to a variable
This commit is contained in:
parent
3a996c132d
commit
7b27b7fed0
@ -24,6 +24,10 @@ import (
|
|||||||
"github.com/astaxie/beego/session"
|
"github.com/astaxie/beego/session"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
USERSTOPRUN = errors.New("User stop run")
|
||||||
|
)
|
||||||
|
|
||||||
type Controller struct {
|
type Controller struct {
|
||||||
Ctx *context.Context
|
Ctx *context.Context
|
||||||
Data map[interface{}]interface{}
|
Data map[interface{}]interface{}
|
||||||
@ -181,7 +185,7 @@ func (c *Controller) Abort(code string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) StopRun() {
|
func (c *Controller) StopRun() {
|
||||||
panic("StopRun")
|
panic(USERSTOPRUN)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) UrlFor(endpoint string, values ...string) string {
|
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) {
|
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" {
|
if err == USERSTOPRUN {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if _, ok := err.(middleware.HTTPException); ok {
|
if _, ok := err.(middleware.HTTPException); ok {
|
||||||
|
Loading…
Reference in New Issue
Block a user