diff --git a/CHANGELOG.md b/CHANGELOG.md index e74ea96..4b09975 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased +- Eagerly fail if `db:` isn't an Integer. #151. + # 0.18.0 - Expose more connection details such as `host`, `db`, etc on `RedisClient`. diff --git a/lib/redis_client/config.rb b/lib/redis_client/config.rb index b12dc28..4f75c75 100644 --- a/lib/redis_client/config.rb +++ b/lib/redis_client/config.rb @@ -41,7 +41,12 @@ def initialize( ) @username = username @password = password - @db = db || DEFAULT_DB + @db = begin + Integer(db || DEFAULT_DB) + rescue ArgumentError + raise ArgumentError, "db: must be an Integer, got: #{db.inspect}" + end + @id = id @ssl = ssl || false