Must catch and translate exceptions on top level
This commit is contained in:
parent
47a3548bea
commit
f63dc86f03
12
cli/main.cpp
12
cli/main.cpp
|
@ -119,7 +119,17 @@ int main(int argc, char* argv[])
|
|||
GetModuleFileNameA(NULL, exename, sizeof(exename)/sizeof(exename[0])-1);
|
||||
argv[0] = exename;
|
||||
#endif
|
||||
return exec.check(argc, argv);
|
||||
|
||||
try {
|
||||
return exec.check(argc, argv);
|
||||
} catch (const InternalError& e) {
|
||||
printf("%s\n", e.errorMessage.c_str());
|
||||
} catch (const std::exception& error) {
|
||||
printf("%s\n", error.what());
|
||||
} catch (...) {
|
||||
printf("Unknown exception\n");
|
||||
}
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,9 +22,17 @@
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
options args(argc, const_cast<const char**>(argv));
|
||||
try {
|
||||
options args(argc, const_cast<const char**>(argv));
|
||||
|
||||
std::size_t failedTestsCount = TestFixture::runTests(args);
|
||||
|
||||
return (failedTestsCount == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
std::size_t failedTestsCount = TestFixture::runTests(args);
|
||||
return (failedTestsCount == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
} catch (const InternalError& e) {
|
||||
printf("%s\n", e.errorMessage.c_str());
|
||||
} catch (const std::exception& error) {
|
||||
printf("%s\n", error.what());
|
||||
} catch (...) {
|
||||
printf("Unknown exception\n");
|
||||
}
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue