079a4113 by astaxie

when call middle.Exception should set w.WriteHeader first

1 parent e01fbd49
...@@ -294,6 +294,11 @@ func RegisterErrorHander() { ...@@ -294,6 +294,11 @@ func RegisterErrorHander() {
294 294
295 func Exception(errcode string, w http.ResponseWriter, r *http.Request, msg string) { 295 func Exception(errcode string, w http.ResponseWriter, r *http.Request, msg string) {
296 if h, ok := ErrorMaps[errcode]; ok { 296 if h, ok := ErrorMaps[errcode]; ok {
297 isint, err := strconv.Atoi(errcode)
298 if err != nil {
299 isint = 500
300 }
301 w.WriteHeader(isint)
297 h(w, r) 302 h(w, r)
298 return 303 return
299 } else { 304 } else {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!