code: function returnError (error, response) {
    if (typeof (response) === 'function') {
      return response(error, null)
    }
  
    if (!response.headersSent) {
      return response.status(500).end(JSON.stringify(error))
    }
  }
docs: In case database call return an error.
  If response parameter is a function consider this is a returnError callback function to call,
  else check if server response headers aren't send yet, log and flush stack trace (if allowed) and return response with status 500 and
  stringified error as content
  
  @param error - A server/database error
  @param response - The server response or returnError callback
  @returns {*} callback call or response with status 500 and associated error