Detailed godoc; better error handling convention

This commit is contained in:
Matthew Holt
2015-03-29 22:01:42 -06:00
parent 0a9a19305c
commit 29fec4742e
3 changed files with 27 additions and 10 deletions

View File

@ -5,6 +5,7 @@ package server
import (
"errors"
"fmt"
"log"
"net/http"
"os"
@ -116,7 +117,13 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
http.StatusInternalServerError)
}
}()
s.stack(w, r)
status, _ := s.stack(w, r)
if status >= 400 {
w.WriteHeader(status)
fmt.Fprintf(w, "%d %s", status, http.StatusText(status))
}
}
// buildStack builds the server's middleware stack based