Browse files

Use global scope to find Error classes (thanks to @wr0ngway)

Change-Id: I6b9bb24d2bda03f298d3f67cb9ff0f9458713abe
Reviewed-on: http://review.couchbase.org/21362
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Reviewed-by: Chris Anderson <jchris@couchbase.com>
  • Loading branch information...
1 parent 42a0e40 commit 477e51051c8b8f49be24fd76d594ffa24f9ae6e1 @avsej avsej committed Oct 4, 2012
Showing with 7 additions and 7 deletions.
  1. +6 −6 lib/active_support/cache/couchbase_store.rb
  2. +1 −1 lib/rack/session/couchbase.rb
View
12 lib/active_support/cache/couchbase_store.rb
@@ -184,7 +184,7 @@ def read_multi(*names)
instrument(:read_multi, names, options) do
@data.get(names, options)
end
- rescue Couchbase::Error::Base => e
+ rescue ::Couchbase::Error::Base => e
logger.error("#{e.class}: #{e.message}") if logger
raise if @raise_errors
false
@@ -245,7 +245,7 @@ def increment(name, amount = 1, options = nil)
payload[:amount] = amount if payload
@data.incr(name, amount, options)
end
- rescue Couchbase::Error::Base => e
+ rescue ::Couchbase::Error::Base => e
logger.error("#{e.class}: #{e.message}") if logger
raise if @raise_errors
false
@@ -277,7 +277,7 @@ def decrement(name, amount = 1, options = nil)
payload[:amount] = amount if payload
@data.decr(name, amount, options)
end
- rescue Couchbase::Error::Base => e
+ rescue ::Couchbase::Error::Base => e
logger.error("#{e.class}: #{e.message}") if logger
raise if @raise_errors
false
@@ -297,7 +297,7 @@ def stats(*arg)
# Read an entry from the cache.
def read_entry(key, options) # :nodoc:
@data.get(key, options)
- rescue Couchbase::Error::Base => e
+ rescue ::Couchbase::Error::Base => e
logger.error("#{e.class}: #{e.message}") if logger
raise if @raise_errors
nil
@@ -314,7 +314,7 @@ def write_entry(key, value, options) # :nodoc:
options[:ttl] ||= ttl
end
@data.send(method, key, value, options)
- rescue Couchbase::Error::Base => e
+ rescue ::Couchbase::Error::Base => e
logger.error("#{e.class}: #{e.message}") if logger
raise if @raise_errors
false
@@ -323,7 +323,7 @@ def write_entry(key, value, options) # :nodoc:
# Delete an entry from the cache.
def delete_entry(key, options) # :nodoc:
@data.delete(key, options)
- rescue Couchbase::Error::Base => e
+ rescue ::Couchbase::Error::Base => e
logger.error("#{e.class}: #{e.message}") if logger
raise if @raise_errors
false
View
2 lib/rack/session/couchbase.rb
@@ -90,7 +90,7 @@ def destroy_session(env, session_id, options)
def with_lock(env, default = nil)
@mutex.lock if env['rack.multithread']
yield
- rescue Couchbase::Error::Connect, Couchbase::Error::Timeout
+ rescue ::Couchbase::Error::Connect, ::Couchbase::Error::Timeout
if $VERBOSE
warn "#{self} is unable to find Couchbase server."
warn $!.inspect

0 comments on commit 477e510

Please sign in to comment.