mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-03-25 09:25:49 +00:00
style: fix Lint/HandleExceptions rubocop
This commit is contained in:
parent
bf4e902407
commit
20d668211e
5 changed files with 11 additions and 5 deletions
|
|
@ -49,8 +49,3 @@ Style/HashSyntax:
|
|||
|
||||
Style/RedundantFreeze:
|
||||
Enabled: true
|
||||
|
||||
# TODO
|
||||
# Remove cop disabling and fix offenses
|
||||
Lint/HandleExceptions:
|
||||
Enabled: false
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ def safe_require(name)
|
|||
begin
|
||||
require name
|
||||
rescue LoadError
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue