style: fix Lint/HandleExceptions rubocop

This commit is contained in:
Gonzalo Rodriguez 2019-02-28 21:17:36 -03:00
parent bf4e902407
commit 20d668211e
No known key found for this signature in database
GPG key ID: 5DB8B81B049B8AB1
5 changed files with 11 additions and 5 deletions

View file

@ -49,8 +49,3 @@ Style/HashSyntax:
Style/RedundantFreeze:
Enabled: true
# TODO
# Remove cop disabling and fix offenses
Lint/HandleExceptions:
Enabled: false

View file

@ -28,6 +28,7 @@ module Rack
client.get(key)
end
rescue Dalli::DalliError
nil
end
def write(key, value, options = {})
@ -35,6 +36,7 @@ module Rack
client.set(key, value, options.fetch(:expires_in, 0), raw: true)
end
rescue Dalli::DalliError
nil
end
def increment(key, amount, options = {})
@ -42,6 +44,7 @@ module Rack
client.incr(key, amount, options.fetch(:expires_in, 0), amount)
end
rescue Dalli::DalliError
nil
end
def delete(key)
@ -49,6 +52,7 @@ module Rack
client.delete(key)
end
rescue Dalli::DalliError
nil
end
private

View file

@ -21,6 +21,7 @@ module Rack
def read(key)
get(key)
rescue Redis::BaseError
nil
end
def write(key, value, options = {})
@ -30,6 +31,7 @@ module Rack
set(key, value)
end
rescue Redis::BaseError
nil
end
def increment(key, amount, options = {})
@ -42,11 +44,13 @@ module Rack
count.value if count
rescue Redis::BaseError
nil
end
def delete(key, _options = {})
del(key)
rescue Redis::BaseError
nil
end
end
end

View file

@ -13,6 +13,7 @@ module Rack
def read(key)
get(key, raw: true)
rescue Redis::BaseError
nil
end
def write(key, value, options = {})
@ -22,6 +23,7 @@ module Rack
set(key, value, raw: true)
end
rescue Redis::BaseError
nil
end
end
end

View file

@ -18,6 +18,7 @@ def safe_require(name)
begin
require name
rescue LoadError
nil
end
end