11977f4f by astaxie

fix #90

1 parent 461eac46
...@@ -43,6 +43,7 @@ var ( ...@@ -43,6 +43,7 @@ var (
43 DirectoryIndex bool //ebable DirectoryIndex default is false 43 DirectoryIndex bool //ebable DirectoryIndex default is false
44 EnbaleHotUpdate bool //enable HotUpdate default is false 44 EnbaleHotUpdate bool //enable HotUpdate default is false
45 HttpServerTimeOut int64 45 HttpServerTimeOut int64
46 ErrorsShow bool
46 ) 47 )
47 48
48 func init() { 49 func init() {
...@@ -70,6 +71,7 @@ func init() { ...@@ -70,6 +71,7 @@ func init() {
70 StaticDir["/static"] = "static" 71 StaticDir["/static"] = "static"
71 AppConfigPath = path.Join(AppPath, "conf", "app.conf") 72 AppConfigPath = path.Join(AppPath, "conf", "app.conf")
72 HttpServerTimeOut = 0 73 HttpServerTimeOut = 0
74 ErrorsShow = true
73 ParseConfig() 75 ParseConfig()
74 } 76 }
75 77
......
...@@ -183,6 +183,9 @@ func ParseConfig() (err error) { ...@@ -183,6 +183,9 @@ func ParseConfig() (err error) {
183 if timeout, err := AppConfig.Int64("httpservertimeout"); err == nil { 183 if timeout, err := AppConfig.Int64("httpservertimeout"); err == nil {
184 HttpServerTimeOut = timeout 184 HttpServerTimeOut = timeout
185 } 185 }
186 if errorsshow, err := AppConfig.Bool("errorsshow"); err == nil {
187 ErrorsShow = errorsshow
188 }
186 } 189 }
187 return nil 190 return nil
188 } 191 }
......
...@@ -189,7 +189,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -189,7 +189,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
189 defer func() { 189 defer func() {
190 if err := recover(); err != nil { 190 if err := recover(); err != nil {
191 errstr := fmt.Sprint(err) 191 errstr := fmt.Sprint(err)
192 if handler, ok := ErrorMaps[errstr]; ok { 192 if handler, ok := ErrorMaps[errstr]; ok && ErrorsShow {
193 handler(rw, r) 193 handler(rw, r)
194 } else { 194 } else {
195 if !RecoverPanic { 195 if !RecoverPanic {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!