mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-21 20:27:13 +01:00
Avoid exceptions scaping during plugin initialization.
Use sub-logging to show the message from exception.
This commit is contained in:
parent
4e88cbf79e
commit
0ebdb909df
@ -67,7 +67,7 @@ void DoReload()
|
|||||||
*/ catch (const Sqrat::Exception & e) /*
|
*/ catch (const Sqrat::Exception & e) /*
|
||||||
*/ { /*
|
*/ { /*
|
||||||
*/ LogErr("Squirrel exception caught (" #ev ") event"); /*
|
*/ LogErr("Squirrel exception caught (" #ev ") event"); /*
|
||||||
*/ LogInf("Message: %s", e.what()); /*
|
*/ LogSInf("Message: %s", e.what()); /*
|
||||||
*/ } /*
|
*/ } /*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -897,15 +897,31 @@ SQMOD_API_EXPORT unsigned int VcmpPluginInit(PluginFuncs * funcs, PluginCallback
|
|||||||
// Attempt to initialize the logger before anything else
|
// Attempt to initialize the logger before anything else
|
||||||
Logger::Get().Initialize(nullptr);
|
Logger::Get().Initialize(nullptr);
|
||||||
// Attempt to initialize the plug-in core
|
// Attempt to initialize the plug-in core
|
||||||
if (!Core::Get().Initialize())
|
try
|
||||||
{
|
{
|
||||||
LogFtl("Unable to initialize the plug-in central core");
|
if (!Core::Get().Initialize())
|
||||||
// Attempt to terminate
|
{
|
||||||
Core::Get().Terminate(false);
|
LogFtl("Unable to initialize the plug-in central core");
|
||||||
// Stop here!
|
// Attempt to terminate
|
||||||
return SQMOD_FAILURE;
|
Core::Get().Terminate(false);
|
||||||
|
// Stop here!
|
||||||
|
return SQMOD_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const Sqrat::Exception & e)
|
||||||
|
{
|
||||||
|
LogErr("Squirrel exception caught during initialization");
|
||||||
|
LogSInf("Message: %s", e.what());
|
||||||
|
}
|
||||||
|
catch (const std::exception & e)
|
||||||
|
{
|
||||||
|
LogErr("System exception caught during initialization");
|
||||||
|
LogSInf("Message: %s", e.what());
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
LogErr("Unknown exception caught during initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind to the server callbacks
|
// Bind to the server callbacks
|
||||||
_Clbk->OnServerInitialise = OnServerInitialise;
|
_Clbk->OnServerInitialise = OnServerInitialise;
|
||||||
_Clbk->OnServerShutdown = OnServerShutdown;
|
_Clbk->OnServerShutdown = OnServerShutdown;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user