enabled more robust logging during errors
This commit is contained in:
parent
a438590f92
commit
3ed33dfac9
@ -72,7 +72,7 @@ func (s *VinegarServlet) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.SendError(w, 404, "Couldn't find your content.")
|
s.SendError(w, req, 404, "Couldn't find your content.")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *VinegarServlet) Start() {
|
func (s *VinegarServlet) Start() {
|
||||||
@ -95,8 +95,8 @@ func (r *VinegarRoute) Announce() {
|
|||||||
log.Printf("Added route for [%s]\n", r.Pattern.String())
|
log.Printf("Added route for [%s]\n", r.Pattern.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *VinegarServlet) SendError(w http.ResponseWriter, code int, msg string) {
|
func (s *VinegarServlet) SendError(w http.ResponseWriter, req *http.Request, code int, msg string) {
|
||||||
fmt.Printf("Reached SendError. Rendering template for code %d with message: %s\n", code, msg)
|
fmt.Printf("[%d][%s]. Rendering template for code %d with message: %s\n", code, req.URL.Path, code, msg)
|
||||||
tmpl, exists := s.ErrorRoutes[code]
|
tmpl, exists := s.ErrorRoutes[code]
|
||||||
if exists {
|
if exists {
|
||||||
tmpl.TemplateManager.AddMixin("code", strconv.Itoa(code))
|
tmpl.TemplateManager.AddMixin("code", strconv.Itoa(code))
|
||||||
|
|||||||
@ -73,7 +73,7 @@ func createSingleFileServletFunction(route *FileRoute) VinegarHandlerFunction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !exists {
|
if !exists {
|
||||||
route.srv.SendError(w, 404, "File not found.")
|
route.srv.SendError(w, req, 404, "File not found.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ func createCompressibleFileServletFunction(route *FileRoute, basePattern string,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
route.srv.SendError(w, 404, "Couldn't find your content.")
|
route.srv.SendError(w, req, 404, "Couldn't find your content.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ func createUncompressedFileServletFunction(route *FileRoute, basePattern string,
|
|||||||
return
|
return
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
route.srv.SendError(w, 404, "Couldn't find your content.")
|
route.srv.SendError(w, req, 404, "Couldn't find your content.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fun
|
return fun
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user