Skip to content

Commit

Permalink
Eagerly fail if db parameter isn't an Integer
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Nov 13, 2023
1 parent 3a1b4f8 commit c0f5cc4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/redis_client/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ def initialize(
)
@username = username
@password = password
@db = db || DEFAULT_DB
begin
@db = Integer(db || DEFAULT_DB)
rescue ArgumentError
raise ArgumentError, "db: must be an Integer, got: #{db.inspect}"
end

@id = id
@ssl = ssl || false

Expand Down

0 comments on commit c0f5cc4

Please sign in to comment.