Catch exceptions from main

This commit is contained in:
Sebastian Messmer 2016-09-24 09:51:29 +02:00
parent dbc1b5db8c
commit a1c3079a68

View File

@ -8,9 +8,15 @@ using cpputils::Random;
using cpputils::SCrypt;
using cpputils::CurlHttpClient;
using std::make_shared;
using std::cerr;
using cpputils::IOStreamConsole;
int main(int argc, const char *argv[]) {
try {
auto &keyGenerator = Random::OSRandom();
return Cli(keyGenerator, SCrypt::DefaultSettings, make_shared<IOStreamConsole>(), make_shared<CurlHttpClient>()).main(argc, argv);
return Cli(keyGenerator, SCrypt::DefaultSettings, make_shared<IOStreamConsole>(),
make_shared<CurlHttpClient>()).main(argc, argv);
} catch (const std::exception &e) {
cerr << "Error: " << e.what();
}
}