function handleError(err, res) {
  const statusCode = err.statusCode || 500;
  const message = err.message || 'Internal server error.';

  logger.error(err, err.trace);

  res.status(statusCode).send(
      {
        status: 'error',
        statusCode,
        message,
      },
  );
}
/**
 * Express error handler
 * @param {ApplicationError} err ApplicationError instance
 * @param {Response} res Express response object
 */
Express error handler
@param {ApplicationError} err ApplicationError instance
@param {Response} res Express response object
Express error handler @param { ApplicationError } err ApplicationError instance @param { Response } res Express response object
function handleError(err, res) {
  const statusCode = err.statusCode || 500;
  const message = err.message || 'Internal server error.';
  logger.error(err, err.trace);
  res.status(statusCode).send(
      {
        status: 'error',
        statusCode,
        message,
      },
  );
}
function handleError ( err , res ) { const statusCode = err . statusCode || 500 ; const message = err . message || 'Internal server error.' ; logger . error ( err , err . trace ) ; res . status ( statusCode ) . send ( { status : 'error' , statusCode , message , } , ) ; }
Express error handler
 @param {ApplicationError} err ApplicationError instance
 @param {Response} res Express response object
Express error handler @param { ApplicationError } err ApplicationError instance @param { Response } res Express response object