mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Core/Server: Catch exceptions in int main()
The exceptions is rethrown on debug mode. Ref Coverity CID 1010213, 1022574, 1227501, 1227502, 1227503, 1227504, 1227505, 1254536 and 1254612
This commit is contained in:
@@ -97,8 +97,7 @@ void ShutdownThreadPool(std::vector<std::thread>& threadPool);
|
||||
bool LoadRealmInfo();
|
||||
variables_map GetConsoleArguments(int argc, char** argv, std::string& cfg_file, std::string& cfg_service);
|
||||
|
||||
/// Launch the Trinity server
|
||||
extern int main(int argc, char** argv)
|
||||
int mainImpl(int argc, char** argv)
|
||||
{
|
||||
std::string configFile = _TRINITY_CORE_CONFIG;
|
||||
std::string configService;
|
||||
@@ -306,6 +305,25 @@ extern int main(int argc, char** argv)
|
||||
return World::GetExitCode();
|
||||
}
|
||||
|
||||
/// Launch the Trinity server
|
||||
extern int main(int argc, char** argv)
|
||||
{
|
||||
try
|
||||
{
|
||||
return mainImpl(argc, argv);
|
||||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
std::cerr << "Top-level exception caught:" << ex.what() << "\n";
|
||||
|
||||
#ifndef NDEBUG // rethrow exception for the debugger
|
||||
throw;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void ShutdownCLIThread(std::thread* cliThread)
|
||||
{
|
||||
if (cliThread != nullptr)
|
||||
|
||||
Reference in New Issue
Block a user