docs: function writeJsonError(res, err, statusCode) {
    var status = err.status || err.statusCode || statusCode || 400;
    var message = 'Unknown error. Please contact support.';
  
    if (err) {
      message = err.userMessage || err.message;
    }
  
    res.status(status);
  
    res.json({
      status: status,
      message: message
    });
  
    res.end();
  }