From 2fda0dc43ef9550a1ada4ff990cc6b31dc30351c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 13 Dec 2022 00:27:36 -0500 Subject: Avoid throwing exceptions from main() --- tests/ingen_test.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/ingen_test.cpp b/tests/ingen_test.cpp index df7e9d34..d6ebee26 100644 --- a/tests/ingen_test.cpp +++ b/tests/ingen_test.cpp @@ -80,8 +80,8 @@ run(int argc, char** argv) try { world = std::make_unique(nullptr, nullptr, nullptr); world->load_configuration(argc, argv); - } catch (std::exception& e) { - std::cout << "ingen: " << e.what() << std::endl; + } catch (const std::exception& e) { + std::cerr << "ingen: " << e.what() << std::endl; return EXIT_FAILURE; } @@ -245,8 +245,13 @@ run(int argc, char** argv) int main(int argc, char** argv) { - ingen::set_bundle_path_from_code( - reinterpret_cast(&ingen::test::ingen_try)); + try { + ingen::set_bundle_path_from_code( + reinterpret_cast(&ingen::test::ingen_try)); - return ingen::test::run(argc, argv); + return ingen::test::run(argc, argv); + } catch (const std::exception& e) { + std::cerr << "ingen: " << e.what() << std::endl; + return EXIT_FAILURE; + } } -- cgit v1.2.1