// syncedErrs couples GoPath's error handling with errStore's error handling. // When the GoPath contained an error, it will be stored in the errStore, so // that all following ops become no-ops. // When however the errStore contains an error, an errorneous GoPath will be // returned. func (s *errStore) syncedErrs(p gopath.GoPath) gopath.GoPath { if s.hasErr() { return gopath.FromErr(s.err) } if p.HasErr() { s.setErr(p.Err()) } return p }
// pathFromRequest maps the request to the filesystem. // It returns a GoPath that might be errorneous. func (i *pathIO) pathFromRequest(request *http.Request) gopath.GoPath { if i.hasErr() { return gopath.FromErr(i.err) } var p = i.contentRoot.JoinPath(request.URL.Path).Do(i.normalizePath).Do(i.guessExtension) if !p.HasErr() && p.IsDirectory() { return i.indexForDirectory(p) } return i.syncedErrs(p.PrependErr("couldn't retrieve path from request")) }