mirror of
https://github.com/astaxie/beego.git
synced 2024-11-26 05:01:28 +00:00
fix #90
This commit is contained in:
parent
461eac46b9
commit
11977f4f77
2
beego.go
2
beego.go
@ -43,6 +43,7 @@ var (
|
|||||||
DirectoryIndex bool //ebable DirectoryIndex default is false
|
DirectoryIndex bool //ebable DirectoryIndex default is false
|
||||||
EnbaleHotUpdate bool //enable HotUpdate default is false
|
EnbaleHotUpdate bool //enable HotUpdate default is false
|
||||||
HttpServerTimeOut int64
|
HttpServerTimeOut int64
|
||||||
|
ErrorsShow bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -70,6 +71,7 @@ func init() {
|
|||||||
StaticDir["/static"] = "static"
|
StaticDir["/static"] = "static"
|
||||||
AppConfigPath = path.Join(AppPath, "conf", "app.conf")
|
AppConfigPath = path.Join(AppPath, "conf", "app.conf")
|
||||||
HttpServerTimeOut = 0
|
HttpServerTimeOut = 0
|
||||||
|
ErrorsShow = true
|
||||||
ParseConfig()
|
ParseConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,6 +183,9 @@ func ParseConfig() (err error) {
|
|||||||
if timeout, err := AppConfig.Int64("httpservertimeout"); err == nil {
|
if timeout, err := AppConfig.Int64("httpservertimeout"); err == nil {
|
||||||
HttpServerTimeOut = timeout
|
HttpServerTimeOut = timeout
|
||||||
}
|
}
|
||||||
|
if errorsshow, err := AppConfig.Bool("errorsshow"); err == nil {
|
||||||
|
ErrorsShow = errorsshow
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
|||||||
defer func() {
|
defer func() {
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
errstr := fmt.Sprint(err)
|
errstr := fmt.Sprint(err)
|
||||||
if handler, ok := ErrorMaps[errstr]; ok {
|
if handler, ok := ErrorMaps[errstr]; ok && ErrorsShow {
|
||||||
handler(rw, r)
|
handler(rw, r)
|
||||||
} else {
|
} else {
|
||||||
if !RecoverPanic {
|
if !RecoverPanic {
|
||||||
|
Loading…
Reference in New Issue
Block a user