From: William Morgan Date: Wed, 24 Jun 2009 13:10:19 +0000 (-0400) Subject: explicitly load index version, for better error messages X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=b6097e518d47e94adb5231451cba6ccbecb7cf00;p=sup 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. --- 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}"