add try to event

This commit is contained in:
2025-03-06 08:15:55 +03:00
parent a27266d9a1
commit 42e9d6c45c

View File

@@ -42,7 +42,21 @@ namespace VE
void connect(event_fn<event> fn) { funcs.push_back(fn); }; void connect(event_fn<event> fn) { funcs.push_back(fn); };
void emit(event e) void emit(event e)
{ {
for(auto& f : funcs) f(e); for(auto& f : funcs)
{
try
{
f(e);
}
catch(std::exception& e)
{
hack::error()(e.what());
}
catch(...)
{
hack::error()("ooops");
}
}
} }
}; };
} }