Adds error formatting

This commit is contained in:
2015-08-12 19:23:53 +02:00
parent e71418fa92
commit 9a123c9281
3 changed files with 59 additions and 19 deletions

View File

@@ -88,7 +88,12 @@ func (fs *StaticFileServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)
//chain handler interface
func (fs *StaticFileServer) ServeHTTPContext(ctx context.Context, rw http.ResponseWriter, req *http.Request) {
fs.ServeHTTP(rw, req)
err := fs.ServeHTTPError(rw, req)
if err != nil {
fsErr := err.(StaticFileServerError)
//use our own context aware error handler
Error(ctx, rw, err.Error(), fsErr.status)
}
}
// chain wrapper. we just ignore the error, and send the request to