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 (cherry picked from commit e68ca82d4d039a401d03de145111b0a738bb9dd7) Conflicts: src/server/bnetserver/Main.cpp
This commit is contained in:
1 parent
a6505dd46a
commit
958999ff5c
2 files changed
+39
-3
No files matched your search
@@ -58,7 +58,7 @@ boost::asio::deadline_timer _dbPingTimer(_ioService);
|
||||
uint32 _dbPingInterval;
|
||||
LoginDatabaseWorkerPool LoginDatabase;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
int mainImpl(int argc, char** argv)
|
||||
{
|
||||
std::string configFile = _TRINITY_REALM_CONFIG;
|
||||
auto vm = GetConsoleArguments(argc, argv, configFile);
|
||||
@@ -144,6 +144,24 @@ int main(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// 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
|
||||
}
|
||||
}
|
||||
|
||||
/// Initialize connection to the database
|
||||
bool StartDB()
|
||||
|
||||
Reference in new issue
Block a user