From ce1bde5de24876b4617b9b2476c84b854d7075e0 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 21 Aug 2024 16:25:08 +0200 Subject: [PATCH] Don't catch std::exception in Debug mode so we can catch array bounds error in debugger cmake will properly define NDEBUG on msvc as well in release mode cf https://gitlab.kitware.com/cmake/cmake/-/blob/1e35163a/Modules/Platform/Windows-MSVC.cmake#L481-483 --- src/EnergyPlus/api/EnergyPlusPgm.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/EnergyPlus/api/EnergyPlusPgm.cc b/src/EnergyPlus/api/EnergyPlusPgm.cc index 88dae209906..800734bc67e 100644 --- a/src/EnergyPlus/api/EnergyPlusPgm.cc +++ b/src/EnergyPlus/api/EnergyPlusPgm.cc @@ -419,10 +419,13 @@ int RunEnergyPlus(EnergyPlus::EnergyPlusData &state, std::string const &filepath EnergyPlus::SimulationManager::ManageSimulation(state); } catch (const EnergyPlus::FatalError &e) { return EnergyPlus::AbortEnergyPlus(state); +#ifdef NDEBUG } catch (const std::exception &e) { ShowSevereError(state, e.what()); return EnergyPlus::AbortEnergyPlus(state); +#endif } + return wrapUpEnergyPlus(state); }