Skip to content
Browse files

should raise named exception instead of RuntimeException

  • Loading branch information...
1 parent a99e0e3 commit dfa6f28229be4db31474733704524d0888658131 Brian Armstrong committed Mar 17, 2013
Showing with 4 additions and 2 deletions.
  1. +3 −1 lib/redis-lock.rb
  2. +1 −1 lib/redis/lock.rb
View
4 lib/redis-lock.rb
@@ -2,4 +2,6 @@
class Redis
include Redis::Lock
-end
+end
+
+class RedisLockException < Exception; end
View
2 lib/redis/lock.rb
@@ -45,7 +45,7 @@ def lock(key, timeout = 60, max_attempts = 100)
end
end
- raise "Unable to acquire lock for #{key}."
+ raise RedisLockException.new("Unable to acquire lock for #{key}.")
rescue => e
if e.message == "Unable to acquire lock for #{key}."
if attempt_counter == max_attempts

0 comments on commit dfa6f28

Please sign in to comment.
Something went wrong with that request. Please try again.