Permalink
Browse files

should raise named exception instead of RuntimeException

  • Loading branch information...
Brian Armstrong
Brian Armstrong committed Mar 18, 2013
1 parent a99e0e3 commit dfa6f28229be4db31474733704524d0888658131
Showing with 4 additions and 2 deletions.
  1. +3 −1 lib/redis-lock.rb
  2. +1 −1 lib/redis/lock.rb
View
@@ -2,4 +2,6 @@
class Redis
include Redis::Lock
-end
+end
+
+class RedisLockException < Exception; end
View
@@ -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.