add try to event
This commit is contained in:
@@ -42,7 +42,21 @@ namespace VE
|
||||
void connect(event_fn<event> fn) { funcs.push_back(fn); };
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user