code: function handleError(err, options) {
    // jshint validthis: true
    // Get access to response object
    var res = this.res;
    var statusCode;
  
    console.log('handleError', err, options);
  
    if (err.name && err.name === 'ValidationError') {
      return res.badRequest(err);
    }
  
    try {
      statusCode = err.status || 500;
      // set the status as a default
      res.status(statusCode);
  
      if (statusCode !== 500 && typeof res[statusCode] === 'function') {
        return res[statusCode](err);
      }
    } catch (e) {
      console.log('Exception while handling error: %s', e);
    }
  
    return res.serverError(err);
  }
docs: Handle generic errors on requests.
  Set status 'Internal Server Error'
  @param {http.ServerResponse} res - The outgoing response object
  @param {Error} [err] - The error that occurred during the request
  @return The given Response with a error status code set (defaults to 500)
  and the error object set as response body.