Last active
August 29, 2015 14:15
-
-
Save DDuarte/42d734d181f400d28f9f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp | |
index 15d08a9..362b5b0 100644 | |
--- a/src/server/worldserver/Main.cpp | |
+++ b/src/server/worldserver/Main.cpp | |
@@ -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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment