code: function error500(req, res, errorText, detail, templateDir, consoleLogFile, appSpec) {
    fsutil.safeTail_p(consoleLogFile, 8192)
    .fail(function(consoleLog) {
      return;
    })
    .then(function(consoleLog) {
      render.sendPage(res, 500, 'An error has occurred', {
        template: 'error-500',
        templateDir: templateDir,
        vars: {
          message: errorText,
          detail: detail,
          console: (appSpec && appSpec.settings.appDefaults.sanitizeErrors) ? null : consoleLog
        }
      });
    })
    .fail(function(err) {
      logger.error('Failed to render error 500 page: ' + err.message);
    })
    .fin(function() {
      try {
        res.end();
      } catch(err) {
        logger.error('Error while cleaning up response: ' + err);
      }
    })
    .done();
  }
docs: Send a 500 error response