code: function error(status, req, res, msg) {
      debug('%s %s', status, req.originalUrl);
      msg = msg || '';
  
      var page = generator.page$['/' + status];
  
      // 404 with no matching status page => redirect to home
      if (!page && status === 404) {
        if (generator.home) return res.redirect(302, '/');
        if (server.statics.defaultFile) return res.redirect(302, server.statics.defaultFile);
      }
  
      // avoid exposing error pages unless authorized
      if (page) {
        if (!server.isPageAuthorized || !server.isPageAuthorized(req, page)) {
          if (server.login) return server.login(req, res);
          else page = null;
        }
      }
  
      if (!page) return res.status(status).send(u.escape(msg));
  
      res.status(status).send(
        generator.renderDoc(page)
          .replace(/%s/g, u.escape(msg)) // TODO - replace with humane.js or proper template
          .replace('<body', '<body data-err-status="' + status + '"' + (msg ? ' data-err-msg="' + u.escape(msg) + '"' : ''))
      );
    }
docs: general purpose error response