Commit 11977f4f authored by astaxie's avatar astaxie

fix #90

parent 461eac46
......@@ -43,6 +43,7 @@ var (
DirectoryIndex bool //ebable DirectoryIndex default is false
EnbaleHotUpdate bool //enable HotUpdate default is false
HttpServerTimeOut int64
ErrorsShow bool
)
func init() {
......@@ -70,6 +71,7 @@ func init() {
StaticDir["/static"] = "static"
AppConfigPath = path.Join(AppPath, "conf", "app.conf")
HttpServerTimeOut = 0
ErrorsShow = true
ParseConfig()
}
......
......@@ -183,6 +183,9 @@ func ParseConfig() (err error) {
if timeout, err := AppConfig.Int64("httpservertimeout"); err == nil {
HttpServerTimeOut = timeout
}
if errorsshow, err := AppConfig.Bool("errorsshow"); err == nil {
ErrorsShow = errorsshow
}
}
return nil
}
......@@ -189,7 +189,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
defer func() {
if err := recover(); err != nil {
errstr := fmt.Sprint(err)
if handler, ok := ErrorMaps[errstr]; ok {
if handler, ok := ErrorMaps[errstr]; ok && ErrorsShow {
handler(rw, r)
} else {
if !RecoverPanic {
......
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