// the exact error from the Redis library.
// https://github.com/andymccurdy/redis-py/blob/master/
// redis/connection.py//L132
if "invalid password" not in str(ex.__cause__):
raise
// Check that we can connect to Redis using the provided password
After Change
// type of the exception.
except Exception as ex:
if not (isinstance(ex.__cause__, redis.AuthenticationError)
and "invalid password" in str(ex.__cause__)) and not (
isinstance(ex, redis.ResponseError) and
"WRONGPASS invalid username-password pair" in str(ex)):
raise
// By contrast, we may be fairly confident the exact string