code: func writeErrorPage(ctx *router.Context, err error, data logData) {
  	ierr := errors.New("LogDog encountered an internal error")
  	switch code := grpcutil.Code(err); code {
  	case codes.Unauthenticated:
  		// Redirect to login screen.
  		var u string
  		u, ierr = auth.LoginURL(ctx.Context, ctx.Request.URL.RequestURI())
  		if ierr == nil {
  			http.Redirect(ctx.Writer, ctx.Request, u, http.StatusFound)
  			return
  		}
  		logging.WithError(ierr).Errorf(ctx.Context, "Error getting Login URL")
  		fallthrough
  	case codes.Internal:
  		// Hide internal errors, expose all other errors.
  		ctx.Writer.WriteHeader(http.StatusInternalServerError)
  	default:
  		ierr = err
  		ctx.Writer.WriteHeader(grpcutil.CodeStatus(code))
  	}
  	if data.options.isHTML() {
  		writeHTMLHeader(ctx, data)
  	}
  	writeFooter(ctx, clock.Now(ctx.Context), ierr, data.options.isHTML())
  }
docs: // writeErrorPage renders an error page.