code: func (handler *UnroutedHandler) sendError(w http.ResponseWriter, r *http.Request, err error) {
  	// Interpret os.ErrNotExist as 404 Not Found
  	if os.IsNotExist(err) {
  		err = ErrNotFound
  	}
  
  	// Errors for read timeouts contain too much information which is not
  	// necessary for us and makes grouping for the metrics harder. The error
  	// message looks like: read tcp 127.0.0.1:1080->127.0.0.1:53673: i/o timeout
  	// Therefore, we use a common error message for all of them.
  	if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
  		err = errors.New("read tcp: i/o timeout")
  	}
  
  	statusErr, ok := err.(HTTPError)
  	if !ok {
  		statusErr = NewHTTPError(err, http.StatusInternalServerError)
  	}
  
  	reason := append(statusErr.Body(), '\n')
  	if r.Method == "HEAD" {
  		reason = nil
  	}
  
  	w.Header().Set("Content-Type", "text/plain; charset=utf-8")
  	w.Header().Set("Content-Length", strconv.Itoa(len(reason)))
  	w.WriteHeader(statusErr.StatusCode())
  	w.Write(reason)
  
  	handler.log("ResponseOutgoing", "status", strconv.Itoa(statusErr.StatusCode()), "method", r.Method, "path", r.URL.Path, "error", err.Error())
  
  	handler.Metrics.incErrorsTotal(statusErr)
  }
docs: // Send the error in the response body. The status code will be looked up in
  // ErrStatusCodes. If none is found 500 Internal Error will be used.