1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-02-21 20:27:13 +01:00

Prevent script exceptions from escaping the IRC session callbacks.

This commit is contained in:
Sandu Liviu Catalin 2016-05-24 20:57:28 +03:00
parent 8ca7f5bfa7
commit 850a742071

View File

@ -638,9 +638,24 @@ void Session::ForwardEvent(Function & listener, CCStr event, CCStr origin, CCStr
parameters.SetValue(i, params[i]);
}
}
// Call the event with the obtained values
// Attempt top execute the callback with the obtained values
try
{
listener.Execute< CSStr, CSStr, Array & >(event, origin, parameters);
}
catch (const Sqrat::Exception & e)
{
_SqMod->LogErr("IRC event [%s] => Squirrel error [%s]", event, e.Message().c_str());
}
catch (const std::exception & e)
{
_SqMod->LogErr("IRC event [%s] => Program error [%s]", event, e.what());
}
catch (...)
{
_SqMod->LogErr("IRC event [%s] => Unknown error", event);
}
}
// ------------------------------------------------------------------------------------------------
void Session::ForwardEvent(Function & listener, Uint32 event,
@ -667,9 +682,24 @@ void Session::ForwardEvent(Function & listener, Uint32 event,
parameters.SetValue(i, params[i]);
}
}
// Call the event with the obtained values
// Attempt top execute the callback with the obtained values
try
{
listener.Execute< Uint32, CSStr, Array & >(event, origin, parameters);
}
catch (const Sqrat::Exception & e)
{
_SqMod->LogErr("IRC event [%s] => Squirrel error [%s]", event, e.Message().c_str());
}
catch (const std::exception & e)
{
_SqMod->LogErr("IRC event [%s] => Program error [%s]", event, e.what());
}
catch (...)
{
_SqMod->LogErr("IRC event [%s] => Unknown error", event);
}
}
// ------------------------------------------------------------------------------------------------
void Session::ForwardEvent(Function & /*listener*/, CCStr /*nick*/,