From 51f74a2f6adb7061fce3a510f0962d56e0fc6336 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Sat, 22 Dec 2018 01:22:24 +0100 Subject: [PATCH] Don't crash but throw if config file can't be loaded --- src/stats/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/stats/main.cpp b/src/stats/main.cpp index b0c8fc38..7a7eecb0 100644 --- a/src/stats/main.cpp +++ b/src/stats/main.cpp @@ -154,14 +154,15 @@ int main(int argc, char* argv[]) { askPassword, make_unique_ref(SCrypt::DefaultSettings) ); + auto config_path = basedir / "cryfs.config"; LocalStateDir localStateDir(cpputils::system::HomeDirectory::getXDGDataDir() / "cryfs"); CryConfigLoader config_loader(console, Random::OSRandom(), std::move(keyProvider), localStateDir, boost::none, boost::none, boost::none); auto config = config_loader.load(config_path, false, true); if (config == boost::none) { - std::cerr << "Error loading config file" << std::endl; - exit(1); + // TODO Show more info about error + throw std::runtime_error("Error loading config file."); } cout << "Listing all blocks..." << flush;