Skip to content

Commit

Permalink
print nice error message when the whistlepig index format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wmorgan committed Jun 9, 2012
1 parent 8473b71 commit dac4e54
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion bin/heliotrope-server
Expand Up @@ -642,7 +642,26 @@ end
FileUtils.mkdir_p opts.dir FileUtils.mkdir_p opts.dir
FileUtils.mkdir_p File.join(opts.dir, "index") FileUtils.mkdir_p File.join(opts.dir, "index")
store = LevelDB::DB.new File.join(opts.dir, "store") 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") hooks = Heliotrope::Hooks.new File.join(opts.dir, "hooks")
metaindex = Heliotrope::MetaIndex.load_or_die! store, index, hooks metaindex = Heliotrope::MetaIndex.load_or_die! store, index, hooks
zmbox = Heliotrope::ZMBox.new File.join(opts.dir, "messages") zmbox = Heliotrope::ZMBox.new File.join(opts.dir, "messages")
Expand Down

0 comments on commit dac4e54

Please sign in to comment.