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,
|
askPassword,
|
||||||
make_unique_ref<SCrypt>(SCrypt::DefaultSettings)
|
make_unique_ref<SCrypt>(SCrypt::DefaultSettings)
|
||||||
);
|
);
|
||||||
|
|
||||||
auto config_path = basedir / "cryfs.config";
|
auto config_path = basedir / "cryfs.config";
|
||||||
LocalStateDir localStateDir(cpputils::system::HomeDirectory::getXDGDataDir() / "cryfs");
|
LocalStateDir localStateDir(cpputils::system::HomeDirectory::getXDGDataDir() / "cryfs");
|
||||||
CryConfigLoader config_loader(console, Random::OSRandom(), std::move(keyProvider), localStateDir, boost::none, boost::none, boost::none);
|
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);
|
auto config = config_loader.load(config_path, false, true);
|
||||||
if (config == boost::none) {
|
if (config == boost::none) {
|
||||||
std::cerr << "Error loading config file" << std::endl;
|
// TODO Show more info about error
|
||||||
exit(1);
|
throw std::runtime_error("Error loading config file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << "Listing all blocks..." << flush;
|
cout << "Listing all blocks..." << flush;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user