From 59ddb58b25f5feed99f9d337952487c06828406f Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Fri, 15 Mar 2013 12:11:38 +0900 Subject: [PATCH] 1.8 compatibility; Use IndexError instead of KeyError. --- lib/http/cookie_jar/abstract_saver.rb | 8 ++++---- lib/http/cookie_jar/abstract_store.rb | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/http/cookie_jar/abstract_saver.rb b/lib/http/cookie_jar/abstract_saver.rb index af5a706..efc6580 100644 --- a/lib/http/cookie_jar/abstract_saver.rb +++ b/lib/http/cookie_jar/abstract_saver.rb @@ -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 diff --git a/lib/http/cookie_jar/abstract_store.rb b/lib/http/cookie_jar/abstract_store.rb index fa854f8..ad1067c 100644 --- a/lib/http/cookie_jar/abstract_store.rb +++ b/lib/http/cookie_jar/abstract_store.rb @@ -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