I've implemented a library wrapper around Ruby's Redis gem.
There are times when I call CacheManager.get("key") and it somehow triggers an error that gets caught in the rescue. The error looks like this: undefined method 'join' for 20325:Integer (NoMethodError)
. The obvious fix is just to call .to_s
on the error.message, but I'd love to understand what's happening and why Redis is returning an integer as its error message.
class CacheManager def self.get(k, default_value = nil) begin $redis_pool.with { |conn| conn.get(k) } || default_value rescue => error Rails.logger.error([error.message] + error.backtrace).join($/) default_value end endend