Skip to content

Instantly share code, notes, and snippets.

@octplane
Created October 27, 2010 16:38
Show Gist options
  • Save octplane/649408 to your computer and use it in GitHub Desktop.
Save octplane/649408 to your computer and use it in GitHub Desktop.
Redis Monkey Patch to get custom exception handling for redis
class RedisException < Exception
attr_accessor :original_exception
end
class Redis
class Client
def call(*args)
begin
process(args) do
read
end
rescue Exception=>e
err = RedisException.new(e.to_s)
err.original_exception = e
raise err
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment