From b6097e518d47e94adb5231451cba6ccbecb7cf00 Mon Sep 17 00:00:00 2001 From: William Morgan Date: Wed, 24 Jun 2009 09:10:19 -0400 Subject: [PATCH] explicitly load index version, for better error messages Catching the LoadError was masking errors from not having dependent library like xapian and gdbm. This change makes the error messages reflect what's actually missing. Since we're adding index types at roughly once every 3 years, an explicit list like this shouldn't be too difficult to maintain. --- lib/sup/index.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/sup/index.rb b/lib/sup/index.rb index 9ec0488..fb46eb0 100644 --- a/lib/sup/index.rb +++ b/lib/sup/index.rb @@ -213,10 +213,10 @@ EOS end index_name = ENV['SUP_INDEX'] || $config[:index] || DEFAULT_INDEX -begin - require "sup/#{index_name}_index" -rescue LoadError - fail "invalid index name #{index_name.inspect}" +case index_name + when "xapian"; require "sup/xapian_index" + when "ferret"; require "sup/ferret_index" + else fail "unknown index type #{index_name.inspect}" end Index = Redwood.const_get "#{index_name.capitalize}Index" Redwood::log "using index #{Index.name}" -- 2.45.2