Don't crash but throw if config file can't be loaded
This commit is contained in:
parent
99688e51ab
commit
51f74a2f6a
@ -154,14 +154,15 @@ int main(int argc, char* argv[]) {
|
||||
askPassword,
|
||||
make_unique_ref<SCrypt>(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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user