diff options
author | David Robillard <d@drobilla.net> | 2022-12-13 00:27:36 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-12-13 00:27:57 -0500 |
commit | 2fda0dc43ef9550a1ada4ff990cc6b31dc30351c (patch) | |
tree | ddb02fa5e8d754cfe10146b3c172b634bcaf0112 | |
parent | 334bedf5f8a8add2b9496682ee301adc2c06a23d (diff) | |
download | ingen-2fda0dc43ef9550a1ada4ff990cc6b31dc30351c.tar.gz ingen-2fda0dc43ef9550a1ada4ff990cc6b31dc30351c.tar.bz2 ingen-2fda0dc43ef9550a1ada4ff990cc6b31dc30351c.zip |
Avoid throwing exceptions from main()
-rw-r--r-- | tests/ingen_test.cpp | 15 |
1 files 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<World>(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<void (*)()>(&ingen::test::ingen_try)); + try { + ingen::set_bundle_path_from_code( + reinterpret_cast<void (*)()>(&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; + } } |