From 2789cbd76dfc8830198cfecd986efa6f24f2d6eb Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Mon, 15 Apr 2024 22:41:38 -0400 Subject: [PATCH] Bugfix: Exceptions in JPluginLoader produce correct exit code --- src/libraries/JANA/CLI/JMain.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libraries/JANA/CLI/JMain.cc b/src/libraries/JANA/CLI/JMain.cc index 6e869c77b..a28d31a02 100644 --- a/src/libraries/JANA/CLI/JMain.cc +++ b/src/libraries/JANA/CLI/JMain.cc @@ -126,10 +126,17 @@ int Execute(JApplication* app, UserOptions &options) { catch (JException& e) { std::cout << "----------------------------------------------------------" << std::endl; std::cout << e << std::endl; + app->SetExitCode((int) JApplication::ExitCode::UnhandledException); } - catch (std::runtime_error& e) { + catch (std::exception& e) { std::cout << "----------------------------------------------------------" << std::endl; std::cout << "Exception: " << e.what() << std::endl; + app->SetExitCode((int) JApplication::ExitCode::UnhandledException); + } + catch (...) { + std::cout << "----------------------------------------------------------" << std::endl; + std::cout << "Unknown exception" << std::endl; + app->SetExitCode((int) JApplication::ExitCode::UnhandledException); } } return (int) app->GetExitCode();