Catch exceptions in main() only if NDEBUG is defined
This commit is contained in:
parent
03b1afc28c
commit
73171b0bc7
|
@ -123,8 +123,11 @@ int main(int argc, char* argv[])
|
|||
argv[0] = exename;
|
||||
#endif
|
||||
|
||||
#ifdef NDEBUG
|
||||
try {
|
||||
#endif
|
||||
return exec.check(argc, argv);
|
||||
#ifdef NDEBUG
|
||||
} catch (const InternalError& e) {
|
||||
printf("%s\n", e.errorMessage.c_str());
|
||||
} catch (const std::exception& error) {
|
||||
|
@ -133,6 +136,7 @@ int main(int argc, char* argv[])
|
|||
printf("Unknown exception\n");
|
||||
}
|
||||
return EXIT_FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,11 +23,14 @@
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef NDEBUG
|
||||
try {
|
||||
#endif
|
||||
options args(argc, const_cast<const char**>(argv));
|
||||
|
||||
std::size_t failedTestsCount = TestFixture::runTests(args);
|
||||
return (failedTestsCount == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
#ifdef NDEBUG
|
||||
} catch (const InternalError& e) {
|
||||
printf("%s\n", e.errorMessage.c_str());
|
||||
} catch (const std::exception& error) {
|
||||
|
@ -36,4 +39,5 @@ int main(int argc, char *argv[])
|
|||
printf("Unknown exception\n");
|
||||
}
|
||||
return EXIT_FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue