Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

print nice error message when the whistlepig index format changes

  • Loading branch information...
commit dac4e54e40ffe3d1e04543159e3b70f2b2a6ce7b 1 parent 8473b71
@wmorgan authored
Showing with 20 additions and 1 deletion.
  1. +20 −1 bin/heliotrope-server
View
21 bin/heliotrope-server
@@ -642,7 +642,26 @@ end
FileUtils.mkdir_p opts.dir
FileUtils.mkdir_p File.join(opts.dir, "index")
store = LevelDB::DB.new File.join(opts.dir, "store")
-index = Whistlepig::Index.new File.join(opts.dir, "index", "whistlepig")
+index = begin
+ Whistlepig::Index.new File.join(opts.dir, "index", "whistlepig")
+rescue Whistlepig::VersionError => e
+ puts <<EOS
+ERROR
+-----
+
+Whistlepig index incompatibility detected!
+Details: #{e.message}
+
+You have upgraded to a version of Whistlepig that represents its data
+differently. You need to rebuild your index. To do this, please run:
+
+ heliotrope-reindex --dir #{opts.dir}
+
+And then restart the server. Heliotrope apologizes for any inconvenience.
+EOS
+ abort
+end
+
hooks = Heliotrope::Hooks.new File.join(opts.dir, "hooks")
metaindex = Heliotrope::MetaIndex.load_or_die! store, index, hooks
zmbox = Heliotrope::ZMBox.new File.join(opts.dir, "messages")
Please sign in to comment.
Something went wrong with that request. Please try again.