Must catch and translate exceptions on top level
This commit is contained in:
parent
47a3548bea
commit
f63dc86f03
10
cli/main.cpp
10
cli/main.cpp
|
@ -119,7 +119,17 @@ int main(int argc, char* argv[])
|
||||||
GetModuleFileNameA(NULL, exename, sizeof(exename)/sizeof(exename[0])-1);
|
GetModuleFileNameA(NULL, exename, sizeof(exename)/sizeof(exename[0])-1);
|
||||||
argv[0] = exename;
|
argv[0] = exename;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
try {
|
||||||
return exec.check(argc, argv);
|
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[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
options args(argc, const_cast<const char**>(argv));
|
options args(argc, const_cast<const char**>(argv));
|
||||||
|
|
||||||
std::size_t failedTestsCount = TestFixture::runTests(args);
|
std::size_t failedTestsCount = TestFixture::runTests(args);
|
||||||
|
|
||||||
return (failedTestsCount == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
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