function checkConnectionClosedHandler(err, req, res, next) {
  if (err && !res.headersSent) {
    if (err.message === 'Connection is closed.' && typeof err.stack === 'string' && err.stack.indexOf('redis/event_handler.js')) {
      res.status(503).send({
        success: false,
        message: err.message,
        connectionClosed: true
      });
      return
    }
  }
  next(err);
}
Express error handler called if some function calls next(errObj)
 This middleware comes before the default error handler and checks if error object was generated by
 RedisClient on redis connection as connection is closed (network errors and similar)
 Returns JSON to client if true, passes error object to next error handler if no connection error

 @param {object} err error object
 @param {object} req Express request object
 @param {object} res Express response object
 @param {function} next Express next() function to call next middleware