1
0
mirror of synced 2024-11-28 01:20:51 +01:00

impr: Catch exceptions thrown by events

This commit is contained in:
WerWolv 2023-11-18 17:23:36 +01:00
parent 3b01dcf230
commit 8f4839d8ff

View File

@ -163,7 +163,11 @@ namespace hex {
for (const auto &[id, event] : getEvents()) {
if (id == E::Id) {
(*static_cast<E *const>(event.get()))(std::forward<decltype(args)>(args)...);
try {
(*static_cast<E *const>(event.get()))(std::forward<decltype(args)>(args)...);
} catch (const std::exception &e) {
log::error("Event '{}' threw {}: {}", wolv::type::getTypeName<decltype(e)>(), wolv::type::getTypeName<E>(), e.what());
}
}
}