Added a bit more debug information to failed requests.

This commit is contained in:
Nathan Osman 2016-04-26 17:46:49 -07:00
parent 54de4f5c3f
commit 397626194f

View File

@ -58,12 +58,14 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
r, eChan, err := s.cache.GetReader(rewrite(req.RequestURI)) r, eChan, err := s.cache.GetReader(rewrite(req.RequestURI))
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
log.Println("[ERR]", err)
return return
} }
defer r.Close() defer r.Close()
e := <-eChan e := <-eChan
if e == nil { if e == nil {
http.Error(w, "header retrieval error", http.StatusInternalServerError) http.Error(w, "header retrieval error", http.StatusInternalServerError)
log.Println("[ERR] header retrieval")
return return
} }
s.writeHeaders(w, e) s.writeHeaders(w, e)