Created
October 27, 2010 16:38
-
-
Save octplane/649408 to your computer and use it in GitHub Desktop.
Redis Monkey Patch to get custom exception handling for redis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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