diff options
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/scopeguard.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/zencore/include/zencore/scopeguard.h b/zencore/include/zencore/scopeguard.h index 13fed4ac5..d04c8ed9c 100644 --- a/zencore/include/zencore/scopeguard.h +++ b/zencore/include/zencore/scopeguard.h @@ -3,6 +3,7 @@ #pragma once #include <type_traits> +#include "logging.h" #include "zencore.h" namespace zen { @@ -15,7 +16,16 @@ public: ~ScopeGuardImpl() { if (!m_dismissed) - m_guardFunc(); + { + try + { + m_guardFunc(); + } + catch (std::exception& Ex) + { + ZEN_ERROR("scope guard threw exception: '{}'", Ex.what()); + } + } } void Dismiss() { m_dismissed = true; } |