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