mirror of
https://github.com/samsonjs/http-cookie.git
synced 2026-03-25 08:55:53 +00:00
1.8 compatibility; Use IndexError instead of KeyError.
This commit is contained in:
parent
05e5d332df
commit
59ddb58b25
2 changed files with 8 additions and 8 deletions
|
|
@ -6,15 +6,15 @@ class HTTP::CookieJar::AbstractSaver
|
|||
|
||||
# Gets an implementation class by the name, optionally trying to
|
||||
# load "http/cookie_jar/*_saver" if not found. If loading fails,
|
||||
# KeyError is raised.
|
||||
# IndexError is raised.
|
||||
def implementation(symbol)
|
||||
@@class_map.fetch(symbol)
|
||||
rescue KeyError
|
||||
rescue IndexError
|
||||
begin
|
||||
require 'http/cookie_jar/%s_saver' % symbol
|
||||
@@class_map.fetch(symbol)
|
||||
rescue LoadError, KeyError => e
|
||||
raise KeyError, 'cookie saver unavailable: %s' % symbol.inspect
|
||||
rescue LoadError, IndexError => e
|
||||
raise IndexError, 'cookie saver unavailable: %s' % symbol.inspect
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -6,15 +6,15 @@ class HTTP::CookieJar::AbstractStore
|
|||
|
||||
# Gets an implementation class by the name, optionally trying to
|
||||
# load "http/cookie_jar/*_store" if not found. If loading fails,
|
||||
# KeyError is raised.
|
||||
# IndexError is raised.
|
||||
def implementation(symbol)
|
||||
@@class_map.fetch(symbol)
|
||||
rescue KeyError
|
||||
rescue IndexError
|
||||
begin
|
||||
require 'http/cookie_jar/%s_store' % symbol
|
||||
@@class_map.fetch(symbol)
|
||||
rescue LoadError, KeyError => e
|
||||
raise KeyError, 'cookie store unavailable: %s' % symbol.inspect
|
||||
rescue LoadError, IndexError => e
|
||||
raise IndexError, 'cookie store unavailable: %s' % symbol.inspect
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue