- added code to now output all eerors to console (with option to save in log file)

- added more LUA debug info
This commit is contained in:
Mark Vejvoda
2010-10-06 20:22:06 +00:00
parent 268aa4793b
commit 0d050f62d4
36 changed files with 185 additions and 60 deletions

View File

@@ -63,7 +63,8 @@ void ChatManager::keyUp(char key){
} }
catch(const exception &ex) { catch(const exception &ex) {
char szBuf[1024]=""; char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); sprintf(szBuf,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
throw runtime_error(szBuf); throw runtime_error(szBuf);
} }
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
@@ -148,6 +149,7 @@ void ChatManager::keyDown(char key){
catch(const exception &ex) { catch(const exception &ex) {
char szBuf[1024]=""; char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
throw runtime_error(szBuf); throw runtime_error(szBuf);
} }
@@ -198,6 +200,7 @@ void ChatManager::updateNetwork() {
catch(const std::exception &ex) { catch(const std::exception &ex) {
char szBuf[1024]=""; char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
throw runtime_error(szBuf); throw runtime_error(szBuf);
} }
} }

View File

@@ -59,6 +59,7 @@ void Console::addLine(string line, bool playSound){
catch(const exception &ex) { catch(const exception &ex) {
char szBuf[1024]=""; char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
throw runtime_error(szBuf); throw runtime_error(szBuf);
} }
} }

View File

@@ -715,7 +715,9 @@ void Game::update() {
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
NetworkManager &networkManager= NetworkManager::getInstance(); NetworkManager &networkManager= NetworkManager::getInstance();
if(networkManager.getGameNetworkInterface() != NULL) { if(networkManager.getGameNetworkInterface() != NULL) {
networkManager.getGameNetworkInterface()->quitGame(true); networkManager.getGameNetworkInterface()->quitGame(true);
@@ -896,6 +898,7 @@ void Game::mouseDownLeft(int x, int y){
} }
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
NetworkManager &networkManager= NetworkManager::getInstance(); NetworkManager &networkManager= NetworkManager::getInstance();
if(networkManager.getGameNetworkInterface() != NULL) { if(networkManager.getGameNetworkInterface() != NULL) {
@@ -910,6 +913,7 @@ void Game::mouseDownRight(int x, int y){
gui.mouseDownRightGraphics(x, y); gui.mouseDownRightGraphics(x, y);
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
NetworkManager &networkManager= NetworkManager::getInstance(); NetworkManager &networkManager= NetworkManager::getInstance();
if(networkManager.getGameNetworkInterface() != NULL) { if(networkManager.getGameNetworkInterface() != NULL) {
@@ -924,6 +928,7 @@ void Game::mouseUpLeft(int x, int y){
gui.mouseUpLeftGraphics(x, y); gui.mouseUpLeftGraphics(x, y);
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
NetworkManager &networkManager= NetworkManager::getInstance(); NetworkManager &networkManager= NetworkManager::getInstance();
if(networkManager.getGameNetworkInterface() != NULL) { if(networkManager.getGameNetworkInterface() != NULL) {
@@ -950,6 +955,7 @@ void Game::mouseDoubleClickLeft(int x, int y){
gui.mouseDoubleClickLeftGraphics(x, y); gui.mouseDoubleClickLeftGraphics(x, y);
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
NetworkManager &networkManager= NetworkManager::getInstance(); NetworkManager &networkManager= NetworkManager::getInstance();
if(networkManager.getGameNetworkInterface() != NULL) { if(networkManager.getGameNetworkInterface() != NULL) {
@@ -1043,6 +1049,7 @@ void Game::mouseMove(int x, int y, const MouseState *ms){
lastMousePos.y = mouseY; lastMousePos.y = mouseY;
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
NetworkManager &networkManager= NetworkManager::getInstance(); NetworkManager &networkManager= NetworkManager::getInstance();
if(networkManager.getGameNetworkInterface() != NULL) { if(networkManager.getGameNetworkInterface() != NULL) {
@@ -1060,6 +1067,7 @@ void Game::eventMouseWheel(int x, int y, int zDelta) {
//gameCamera.setMoveY(1); //gameCamera.setMoveY(1);
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
NetworkManager &networkManager= NetworkManager::getInstance(); NetworkManager &networkManager= NetworkManager::getInstance();
if(networkManager.getGameNetworkInterface() != NULL) { if(networkManager.getGameNetworkInterface() != NULL) {
@@ -1237,6 +1245,7 @@ void Game::keyDown(char key) {
//throw runtime_error("Test Error!"); //throw runtime_error("Test Error!");
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
NetworkManager &networkManager= NetworkManager::getInstance(); NetworkManager &networkManager= NetworkManager::getInstance();
if(networkManager.getGameNetworkInterface() != NULL) { if(networkManager.getGameNetworkInterface() != NULL) {
@@ -1277,6 +1286,7 @@ void Game::keyUp(char key){
} }
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
NetworkManager &networkManager= NetworkManager::getInstance(); NetworkManager &networkManager= NetworkManager::getInstance();
if(networkManager.getGameNetworkInterface() != NULL) { if(networkManager.getGameNetworkInterface() != NULL) {

View File

@@ -110,6 +110,7 @@ Config::Config(std::pair<ConfigType,ConfigType> type, std::pair<string,string> f
} }
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] ERROR trying to auto-create cfgFile.second = [%s]\n",__FILE__,__FUNCTION__,__LINE__,fileName.second.c_str()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] ERROR trying to auto-create cfgFile.second = [%s]\n",__FILE__,__FUNCTION__,__LINE__,fileName.second.c_str());
} }

View File

@@ -70,22 +70,28 @@ void Lang::loadScenarioStrings(const string &scenarioDir, const string &scenario
} }
} }
string Lang::get(const string &s){ string Lang::get(const string &s) {
try{ try{
string result = strings.getString(s); string result = strings.getString(s);
replaceAll(result, "\\n", "\n"); replaceAll(result, "\\n", "\n");
return result; return result;
} }
catch(exception &){ catch(exception &ex) {
if(strings.getpath() != "") {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
}
return "???" + s + "???"; return "???" + s + "???";
} }
} }
string Lang::getScenarioString(const string &s){ string Lang::getScenarioString(const string &s) {
try{ try{
return scenarioStrings.getString(s); return scenarioStrings.getString(s);
} }
catch(exception &){ catch(exception &ex) {
if(scenarioStrings.getpath() != "") {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
}
return "???" + s + "???"; return "???" + s + "???";
} }
} }

View File

@@ -17,11 +17,12 @@
#include "model.h" #include "model.h"
#include "config.h" #include "config.h"
#include "game_constants.h" #include "game_constants.h"
#include "util.h"
#include "leak_dumper.h" #include "leak_dumper.h"
using namespace Shared::Xml; using namespace Shared::Xml;
using namespace Shared::Graphics; using namespace Shared::Graphics;
using namespace Shared::Util;
namespace Glest{ namespace Game{ namespace Glest{ namespace Game{
@@ -202,6 +203,7 @@ void ParticleSystemTypeProjectile::load(const string &dir, const string &path,Re
} }
} }
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error loading ParticleSystem: "+ path + "\n" +e.what()); throw runtime_error("Error loading ParticleSystem: "+ path + "\n" +e.what());
} }
} }
@@ -246,6 +248,7 @@ void ParticleSystemTypeSplash::load(const string &dir, const string &path,Render
horizontalSpreadB= horizontalSpreadNode->getAttribute("b")->getFloatValue(-1.0f, 1.0f); horizontalSpreadB= horizontalSpreadNode->getAttribute("b")->getFloatValue(-1.0f, 1.0f);
} }
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error loading ParticleSystem: "+ path + "\n" +e.what()); throw runtime_error("Error loading ParticleSystem: "+ path + "\n" +e.what());
} }
} }

View File

@@ -16,12 +16,12 @@
#include "xml_parser.h" #include "xml_parser.h"
#include "config.h" #include "config.h"
#include "game_constants.h" #include "game_constants.h"
//#include "renderer.h"
#include "leak_dumper.h" #include "leak_dumper.h"
using namespace Shared::Xml; using namespace Shared::Xml;
using namespace Shared::Graphics; using namespace Shared::Graphics;
using namespace Shared::Util;
namespace Glest{ namespace Game{ namespace Glest{ namespace Game{
@@ -220,6 +220,7 @@ void UnitParticleSystemType::load(const string &dir, const string &path, Rendere
UnitParticleSystemType::load(particleSystemNode, dir, renderer); UnitParticleSystemType::load(particleSystemNode, dir, renderer);
} }
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error loading ParticleSystem: "+ path + "\n" +e.what()); throw runtime_error("Error loading ParticleSystem: "+ path + "\n" +e.what());
} }
} }

View File

@@ -82,11 +82,12 @@ enum GAME_ARG_TYPE {
class ExceptionHandler: public PlatformExceptionHandler{ class ExceptionHandler: public PlatformExceptionHandler{
public: public:
virtual void handle(){ virtual void handle() {
string msg = "#1 An error ocurred and Glest will close.\nPlease report this bug to "+mailString; string msg = "#1 An error ocurred and Glest will close.\nPlease report this bug to "+mailString;
#ifdef WIN32 #ifdef WIN32
msg += ", attaching the generated "+getCrashDumpFileName()+" file."; msg += ", attaching the generated "+getCrashDumpFileName()+" file.";
#endif #endif
SystemFlags::OutputDebug(SystemFlags::debugError,"%s\n",msg.c_str());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s\n",msg.c_str()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s\n",msg.c_str());
Program *program = Program::getInstance(); Program *program = Program::getInstance();
@@ -101,6 +102,7 @@ public:
static void handleRuntimeError(const char *msg) { static void handleRuntimeError(const char *msg) {
Program *program = Program::getInstance(); Program *program = Program::getInstance();
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] [%s] gameInitialized = %d, program = %p\n",__FILE__,__FUNCTION__,__LINE__,msg,gameInitialized,program);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] [%s] gameInitialized = %d, program = %p\n",__FILE__,__FUNCTION__,__LINE__,msg,gameInitialized,program); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] [%s] gameInitialized = %d, program = %p\n",__FILE__,__FUNCTION__,__LINE__,msg,gameInitialized,program);
if(program && gameInitialized == true) { if(program && gameInitialized == true) {
@@ -566,13 +568,14 @@ int glestMain(int argc, char** argv){
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled = config.getBool("DebugMode","false"); SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled = config.getBool("DebugMode","false");
SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled = config.getBool("DebugNetwork","false"); SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled = config.getBool("DebugNetwork","false");
SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled = config.getBool("DebugPerformance","false"); SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled = config.getBool("DebugPerformance","false");
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled = config.getBool("DebugWorldSynch","false"); SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled = config.getBool("DebugWorldSynch","false");
SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled = config.getBool("DebugUnitCommands","false"); SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled = config.getBool("DebugUnitCommands","false");
SystemFlags::getSystemSettingType(SystemFlags::debugPathFinder).enabled = config.getBool("DebugPathFinder","false"); SystemFlags::getSystemSettingType(SystemFlags::debugPathFinder).enabled = config.getBool("DebugPathFinder","false");
SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled = config.getBool("DebugLUA","false"); SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled = config.getBool("DebugLUA","false");
SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled = config.getBool("DebugError","true");
string debugLogFile = config.getString("DebugLogFile",""); string debugLogFile = config.getString("DebugLogFile","");
if(getGameReadWritePath() != "") { if(getGameReadWritePath() != "") {
@@ -602,6 +605,7 @@ int glestMain(int argc, char** argv){
if(debugLUALogFile == "") { if(debugLUALogFile == "") {
debugLUALogFile = debugLogFile; debugLUALogFile = debugLogFile;
} }
string debugErrorLogFile = config.getString("DebugLogFileError","");
SystemFlags::getSystemSettingType(SystemFlags::debugSystem).debugLogFileName = debugLogFile; SystemFlags::getSystemSettingType(SystemFlags::debugSystem).debugLogFileName = debugLogFile;
SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).debugLogFileName = debugNetworkLogFile; SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).debugLogFileName = debugNetworkLogFile;
@@ -610,16 +614,18 @@ int glestMain(int argc, char** argv){
SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).debugLogFileName = debugUnitCommandsLogFile; SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).debugLogFileName = debugUnitCommandsLogFile;
SystemFlags::getSystemSettingType(SystemFlags::debugPathFinder).debugLogFileName = debugPathFinderLogFile; SystemFlags::getSystemSettingType(SystemFlags::debugPathFinder).debugLogFileName = debugPathFinderLogFile;
SystemFlags::getSystemSettingType(SystemFlags::debugLUA).debugLogFileName = debugLUALogFile; SystemFlags::getSystemSettingType(SystemFlags::debugLUA).debugLogFileName = debugLUALogFile;
SystemFlags::getSystemSettingType(SystemFlags::debugError).debugLogFileName = debugErrorLogFile;
if(haveSpecialOutputCommandLineOption == false) { if(haveSpecialOutputCommandLineOption == false) {
printf("Startup settings are: debugSystem [%d], debugNetwork [%d], debugPerformance [%d], debugWorldSynch [%d], debugUnitCommands[%d], debugPathFinder[%d], debugLUA [%d]\n", printf("Startup settings are: debugSystem [%d], debugNetwork [%d], debugPerformance [%d], debugWorldSynch [%d], debugUnitCommands[%d], debugPathFinder[%d], debugLUA [%d], debugError [%d]\n",
SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled, SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled,
SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled, SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled,
SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled, SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled,
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled, SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled,
SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled, SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled,
SystemFlags::getSystemSettingType(SystemFlags::debugPathFinder).enabled, SystemFlags::getSystemSettingType(SystemFlags::debugPathFinder).enabled,
SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled); SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled,
SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled);
} }
NetworkInterface::setDisplayMessageFunction(ExceptionHandler::DisplayMessage); NetworkInterface::setDisplayMessageFunction(ExceptionHandler::DisplayMessage);

View File

@@ -439,8 +439,7 @@ void Program::setState(ProgramState *programState, bool cleanupOldState)
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
} }
catch(const exception &e){ catch(const exception &e){
//exceptionMessage(e); SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
//throw runtime_error(e.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
this->showMessage(e.what()); this->showMessage(e.what());
setState(new Intro(this)); setState(new Intro(this));

View File

@@ -617,6 +617,7 @@ void MenuStateConnectedGame::render() {
catch(const std::exception &ex) { catch(const std::exception &ex) {
char szBuf[1024]=""; char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
throw runtime_error(szBuf); throw runtime_error(szBuf);
} }
} }
@@ -1062,6 +1063,7 @@ void MenuStateConnectedGame::update() {
catch(const runtime_error &ex) { catch(const runtime_error &ex) {
char szBuf[1024]=""; char szBuf[1024]="";
sprintf(szBuf,"Error [%s]",ex.what()); sprintf(szBuf,"Error [%s]",ex.what());
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] %s\n",__FILE__,__FUNCTION__,__LINE__,szBuf); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] %s\n",__FILE__,__FUNCTION__,__LINE__,szBuf);
//throw runtime_error(szBuf); //throw runtime_error(szBuf);
showMessageBox( szBuf, "Error", false); showMessageBox( szBuf, "Error", false);
@@ -1170,6 +1172,7 @@ bool MenuStateConnectedGame::hasNetworkGameSettings()
catch(const std::exception &ex) { catch(const std::exception &ex) {
char szBuf[1024]=""; char szBuf[1024]="";
sprintf(szBuf,"Error [%s]",ex.what()); sprintf(szBuf,"Error [%s]",ex.what());
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] %s\n",__FILE__,__FUNCTION__,__LINE__,szBuf); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] %s\n",__FILE__,__FUNCTION__,__LINE__,szBuf);
//throw runtime_error(szBuf); //throw runtime_error(szBuf);
showMessageBox( szBuf, "Error", false); showMessageBox( szBuf, "Error", false);
@@ -1425,6 +1428,7 @@ bool MenuStateConnectedGame::loadMapInfo(string file, MapInfo *mapInfo, bool loa
} }
} }
catch(exception &e){ catch(exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
//throw runtime_error("Error loading map file: "+file+'\n'+e.what()); //throw runtime_error("Error loading map file: "+file+'\n'+e.what());

View File

@@ -85,7 +85,8 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
catch(const std::exception &ex) { catch(const std::exception &ex) {
serverInitError = true; serverInitError = true;
char szBuf[1024]=""; char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); sprintf(szBuf,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf); SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
//throw runtime_error(szBuf);!!! //throw runtime_error(szBuf);!!!
showGeneralError=true; showGeneralError=true;
@@ -1237,6 +1238,7 @@ void MenuStateCustomGame::update() {
} }
} }
catch(const runtime_error &e) { catch(const runtime_error &e) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] caught exception error = [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] caught exception error = [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
} }
} }
@@ -1262,6 +1264,7 @@ void MenuStateCustomGame::update() {
} }
} }
catch(const runtime_error &e) { catch(const runtime_error &e) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] caught exception error = [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] caught exception error = [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
} }
} }
@@ -1548,6 +1551,7 @@ void MenuStateCustomGame::update() {
catch(const std::exception &ex) { catch(const std::exception &ex) {
char szBuf[1024]=""; char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf); SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
//throw runtime_error(szBuf); //throw runtime_error(szBuf);
showGeneralError=true; showGeneralError=true;
@@ -2023,6 +2027,7 @@ GameSettings MenuStateCustomGame::loadGameSettingsFromFile(std::string fileName)
} }
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] ERROR = [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] ERROR = [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
showMessageBox( ex.what(), "Error", false); showMessageBox( ex.what(), "Error", false);
@@ -2055,8 +2060,8 @@ bool MenuStateCustomGame::hasNetworkGameSettings() {
} }
catch(const std::exception &ex) { catch(const std::exception &ex) {
char szBuf[1024]=""; char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); sprintf(szBuf,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
//throw runtime_error(szBuf); SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf); SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
showGeneralError=true; showGeneralError=true;
generalErrorToShow = ex.what(); generalErrorToShow = ex.what();
@@ -2111,7 +2116,8 @@ void MenuStateCustomGame::loadMapInfo(string file, MapInfo *mapInfo, bool loadMa
mapPreview.loadFromFile(file.c_str()); mapPreview.loadFromFile(file.c_str());
} }
} }
catch(exception &e){ catch(exception &e) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s] loading map [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what(),file.c_str());
throw runtime_error("Error loading map file: [" + file + "] msg: " + e.what()); throw runtime_error("Error loading map file: [" + file + "] msg: " + e.what());
} }
@@ -2178,7 +2184,8 @@ void MenuStateCustomGame::updateControlers(){
} }
catch(const std::exception &ex) { catch(const std::exception &ex) {
char szBuf[1024]=""; char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); sprintf(szBuf,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
throw runtime_error(szBuf); throw runtime_error(szBuf);
} }
} }
@@ -2197,7 +2204,8 @@ void MenuStateCustomGame::closeUnusedSlots(){
} }
catch(const std::exception &ex) { catch(const std::exception &ex) {
char szBuf[1024]=""; char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); sprintf(szBuf,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
throw runtime_error(szBuf); throw runtime_error(szBuf);
} }
} }
@@ -2215,6 +2223,7 @@ void MenuStateCustomGame::updateNetworkSlots() {
catch(const std::exception &ex) { catch(const std::exception &ex) {
char szBuf[1024]=""; char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf); SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
showGeneralError=true; showGeneralError=true;
if(serverInterface->isPortBound() == false) { if(serverInterface->isPortBound() == false) {
@@ -2236,7 +2245,8 @@ void MenuStateCustomGame::updateNetworkSlots() {
} }
catch(const std::exception &ex) { catch(const std::exception &ex) {
char szBuf[1024]=""; char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); sprintf(szBuf,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf); SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
//throw runtime_error(szBuf);!!! //throw runtime_error(szBuf);!!!
showGeneralError=true; showGeneralError=true;

View File

@@ -531,6 +531,7 @@ void MenuStateMasterserver::updateServerInfo() {
safeMutex.ReleaseLock(true); safeMutex.ReleaseLock(true);
} }
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d, error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d, error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
threadedErrorMsg = e.what(); threadedErrorMsg = e.what();
} }

View File

@@ -368,6 +368,7 @@ void ClientInterface::updateLobby() {
//} //}
} }
catch(const runtime_error &ex) { catch(const runtime_error &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
string sErr = ex.what(); string sErr = ex.what();
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error during processing, sErr = [%s]\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error during processing, sErr = [%s]\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str());

View File

@@ -134,6 +134,7 @@ void ConnectionSlotThread::execute() {
catch(const exception &ex) { catch(const exception &ex) {
setRunningStatus(false); setRunningStatus(false);
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
throw runtime_error(ex.what()); throw runtime_error(ex.what());
@@ -644,6 +645,7 @@ void ConnectionSlot::update(bool checkForNewClients) {
} }
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error detected [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error detected [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
threadErrorList.push_back(ex.what()); threadErrorList.push_back(ex.what());

View File

@@ -387,6 +387,7 @@ std::pair<bool,bool> ServerInterface::clientLagCheck(ConnectionSlot* connectionS
catch(const exception &ex) { catch(const exception &ex) {
alreadyInLagCheck = false; alreadyInLagCheck = false;
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
throw runtime_error(ex.what()); throw runtime_error(ex.what());
} }
@@ -518,6 +519,7 @@ void ServerInterface::update() {
} }
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error detected [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error detected [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
errorMsgList.push_back(ex.what()); errorMsgList.push_back(ex.what());
} }
@@ -608,6 +610,7 @@ void ServerInterface::update() {
} }
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error detected [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error detected [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
errorMsgList.push_back(ex.what()); errorMsgList.push_back(ex.what());
} }
@@ -676,6 +679,7 @@ void ServerInterface::update() {
} }
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error detected [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error detected [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
errorMsgList.push_back(ex.what()); errorMsgList.push_back(ex.what());
} }
@@ -687,6 +691,7 @@ void ServerInterface::update() {
} }
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error detected [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error detected [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
errorMsgList.push_back(ex.what()); errorMsgList.push_back(ex.what());
} }
@@ -740,6 +745,7 @@ void ServerInterface::updateKeyframe(int frameCount){
broadcastMessage(&networkMessageCommandList); broadcastMessage(&networkMessageCommandList);
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error detected [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error detected [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
DisplayErrorMessage(ex.what()); DisplayErrorMessage(ex.what());
} }
@@ -937,6 +943,7 @@ void ServerInterface::waitUntilReady(Checksum* checksum){
gameStartTime = time(NULL); gameStartTime = time(NULL);
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error detected [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error detected [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
DisplayErrorMessage(ex.what()); DisplayErrorMessage(ex.what());
} }
@@ -1168,6 +1175,7 @@ void ServerInterface::broadcastMessage(const NetworkMessage* networkMessage, int
} }
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
//throw runtime_error(ex.what()); //throw runtime_error(ex.what());
@@ -1196,6 +1204,7 @@ void ServerInterface::broadcastMessageToConnectedClients(const NetworkMessage* n
} }
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
//throw runtime_error(ex.what()); //throw runtime_error(ex.what());
DisplayErrorMessage(ex.what()); DisplayErrorMessage(ex.what());

View File

@@ -85,6 +85,7 @@ void FactionType::load(const string &dir, const TechTree *techTree, Checksum* ch
} }
} }
catch(const exception &e) { catch(const exception &e) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error loading units: "+ dir + "\n" + e.what()); throw runtime_error("Error loading units: "+ dir + "\n" + e.what());
} }
@@ -98,6 +99,7 @@ void FactionType::load(const string &dir, const TechTree *techTree, Checksum* ch
} }
} }
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error loading upgrades: "+ dir + "\n" + e.what()); throw runtime_error("Error loading upgrades: "+ dir + "\n" + e.what());
} }

View File

@@ -128,6 +128,7 @@ void ResourceType::load(const string &dir, Checksum* checksum){
} }
} }
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error loading resource type: " + path + "\n" + e.what()); throw runtime_error("Error loading resource type: " + path + "\n" + e.what());
} }
} }

View File

@@ -64,6 +64,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
} }
} }
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error loading Resource Types: "+ dir + "\n" + e.what()); throw runtime_error("Error loading Resource Types: "+ dir + "\n" + e.what());
} }
@@ -118,6 +119,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
} }
} }
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error loading Tech Tree: "+ dir + "\n" + e.what()); throw runtime_error("Error loading Tech Tree: "+ dir + "\n" + e.what());
} }
@@ -148,6 +150,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
} }
} }
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error loading Faction Types: "+ dir + "\n" + e.what()); throw runtime_error("Error loading Faction Types: "+ dir + "\n" + e.what());
} }
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);

View File

@@ -389,6 +389,7 @@ void UnitType::load(int id,const string &dir, const TechTree *techTree, const Fa
} }
//Exception handling (conversions and so on); //Exception handling (conversions and so on);
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error loading UnitType: " + path + "\n" + e.what()); throw runtime_error("Error loading UnitType: " + path + "\n" + e.what());
} }

View File

@@ -123,6 +123,7 @@ void UpgradeType::load(const string &dir, const TechTree *techTree, const Factio
} }
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error loading UpgradeType: "+ dir + "\n" +e.what()); throw runtime_error("Error loading UpgradeType: "+ dir + "\n" +e.what());
} }

View File

@@ -215,6 +215,7 @@ void Map::load(const string &path, TechTree *techTree, Tileset *tileset){
fclose(f); fclose(f);
} }
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error loading map: "+ path+ "\n"+ e.what()); throw runtime_error("Error loading map: "+ path+ "\n"+ e.what());
} }
} }

View File

@@ -1,7 +1,7 @@
// ============================================================== // ==============================================================
// This file is part of Glest (www.glest.org) // This file is part of Glest (www.glest.org)
// //
// Copyright (C) 2001-2005 Marti<EFBFBD>o Figueroa // Copyright (C) 2001-2005 Martio Figueroa
// //
// You can redistribute this code and/or modify it under // You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published // the terms of the GNU General Public License as published
@@ -53,6 +53,7 @@ void Scenario::load(const string &path){
} }
//Exception handling (conversions and so on); //Exception handling (conversions and so on);
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error: " + path + "\n" + e.what()); throw runtime_error("Error: " + path + "\n" + e.what());
} }
} }

View File

@@ -242,6 +242,7 @@ void Tileset::load(const string &dir, Checksum *checksum){
} }
//Exception handling (conversions and so on); //Exception handling (conversions and so on);
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error: " + path + "\n" + e.what()); throw runtime_error("Error: " + path + "\n" + e.what());
} }
} }

View File

@@ -71,9 +71,9 @@ public:
void setFloat(const string &key, float value); void setFloat(const string &key, float value);
void setString(const string &key, const string &value); void setString(const string &key, const string &value);
string getpath() const { return path;}
string toString(); string toString();
}; };
}}//end namespace }}//end namespace

View File

@@ -44,6 +44,7 @@ public:
debugUnitCommands, debugUnitCommands,
debugPathFinder, debugPathFinder,
debugLUA, debugLUA,
debugError
}; };
class SystemFlagsType class SystemFlagsType

View File

@@ -1,7 +1,7 @@
// ============================================================== // ==============================================================
// This file is part of Glest Shared Library (www.glest.org) // This file is part of Glest Shared Library (www.glest.org)
// //
// Copyright (C) 2001-2008 Marti<EFBFBD>o Figueroa // Copyright (C) 2001-2008 Martio Figueroa
// //
// You can redistribute this code and/or modify it under // You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published // the terms of the GNU General Public License as published
@@ -493,6 +493,7 @@ void Model::loadG3d(const string &path){
fclose(f); fclose(f);
} }
catch(exception &e){ catch(exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Exception caught loading 3d file: " + path +"\n"+ e.what()); throw runtime_error("Exception caught loading 3d file: " + path +"\n"+ e.what());
} }
} }

View File

@@ -68,36 +68,49 @@ LuaScript::~LuaScript() {
void LuaScript::loadCode(const string &code, const string &name){ void LuaScript::loadCode(const string &code, const string &name){
Lua_STREFLOP_Wrapper streflopWrapper; Lua_STREFLOP_Wrapper streflopWrapper;
int errorCode= luaL_loadbuffer(luaState, code.c_str(), code.size(), name.c_str()); int errorCode= luaL_loadbuffer(luaState, code.c_str(), code.length(), name.c_str());
if(errorCode!=0){ if(errorCode !=0 ) {
throw runtime_error("Error loading lua code: " + errorToString(errorCode)); throw runtime_error("Error loading lua code: " + errorToString(errorCode));
} }
//SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] name [%s], errorCode = %d,\ncode [%s]\n",__FILE__,__FUNCTION__,__LINE__,name.c_str(),errorCode,code.c_str());
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] name [%s], errorCode = %d\n",__FILE__,__FUNCTION__,__LINE__,name.c_str(),errorCode);
//run code //run code
errorCode= lua_pcall(luaState, 0, 0, 0)!=0; errorCode= lua_pcall(luaState, 0, 0, 0);
if(errorCode!=0){ if(errorCode !=0 ) {
throw runtime_error("Error initializing lua: " + errorToString(errorCode)); throw runtime_error("Error initializing lua: " + errorToString(errorCode));
} }
//SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] name [%s], errorCode = %d,\ncode [%s]\n",__FILE__,__FUNCTION__,__LINE__,name.c_str(),errorCode,code.c_str());
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] name [%s], errorCode = %d\n",__FILE__,__FUNCTION__,__LINE__,name.c_str(),errorCode);
} }
void LuaScript::beginCall(const string& functionName){ void LuaScript::beginCall(const string& functionName){
Lua_STREFLOP_Wrapper streflopWrapper; Lua_STREFLOP_Wrapper streflopWrapper;
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] functionName [%s]\n",__FILE__,__FUNCTION__,__LINE__,functionName.c_str());
SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] functionName [%s]\n",__FILE__,__FUNCTION__,__LINE__,functionName.c_str()); SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] functionName [%s]\n",__FILE__,__FUNCTION__,__LINE__,functionName.c_str());
lua_getglobal(luaState, functionName.c_str()); lua_getglobal(luaState, functionName.c_str());
//if( lua_isfunction(luaState,lua_gettop(luaState)) == false) {
// throw runtime_error("Error unknown lua function called: [" + functionName + "]");
//}
argumentCount= 0; argumentCount= 0;
} }
void LuaScript::endCall(){ void LuaScript::endCall(){
Lua_STREFLOP_Wrapper streflopWrapper; Lua_STREFLOP_Wrapper streflopWrapper;
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
lua_pcall(luaState, argumentCount, 0, 0); lua_pcall(luaState, argumentCount, 0, 0);
} }
void LuaScript::registerFunction(LuaFunction luaFunction, const string &functionName) { void LuaScript::registerFunction(LuaFunction luaFunction, const string &functionName) {
Lua_STREFLOP_Wrapper streflopWrapper; Lua_STREFLOP_Wrapper streflopWrapper;
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] functionName [%s]\n",__FILE__,__FUNCTION__,__LINE__,functionName.c_str());
lua_pushcfunction(luaState, luaFunction); lua_pushcfunction(luaState, luaFunction);
lua_setglobal(luaState, functionName.c_str()); lua_setglobal(luaState, functionName.c_str());
} }

View File

@@ -59,10 +59,12 @@ void FileCRCPreCacheThread::execute() {
} }
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
setRunningStatus(false); setRunningStatus(false);
} }
catch(...) { catch(...) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] UNKNOWN Error\n",__FILE__,__FUNCTION__,__LINE__);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] unknown error\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] unknown error\n",__FILE__,__FUNCTION__,__LINE__);
setRunningStatus(false); setRunningStatus(false);
} }
@@ -135,6 +137,8 @@ void SimpleTaskThread::execute() {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str());
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
setRunningStatus(false); setRunningStatus(false);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str());

View File

@@ -1560,10 +1560,12 @@ void BroadCastClientSocketThread::execute() {
} }
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
//setRunningStatus(false); //setRunningStatus(false);
} }
catch(...) { catch(...) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] UNKNOWN Error\n",__FILE__,__FUNCTION__,__LINE__);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] unknown error\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] unknown error\n",__FILE__,__FUNCTION__,__LINE__);
//setRunningStatus(false); //setRunningStatus(false);
} }
@@ -1886,11 +1888,13 @@ void BroadCastSocketThread::execute() {
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); //SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
} }
catch(const exception &ex) { catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
this->setQuitStatus(true); this->setQuitStatus(true);
//setRunningStatus(false); //setRunningStatus(false);
} }
catch(...) { catch(...) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] UNKNOWN Error\n",__FILE__,__FUNCTION__,__LINE__);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] unknown error\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] unknown error\n",__FILE__,__FUNCTION__,__LINE__);
this->setQuitStatus(true); this->setQuitStatus(true);
//setRunningStatus(false); //setRunningStatus(false);

View File

@@ -272,22 +272,22 @@ bool Window::handleEvent() {
} }
} }
catch(const char *e){ catch(const char *e){
std::cerr << "(a1) Couldn't process event: " << e << " codelocation = " << codeLocation << "\n"; SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (a1) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e,codeLocation.c_str());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] (a1) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e,codeLocation.c_str()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (a1) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e,codeLocation.c_str());
throw runtime_error(e); throw runtime_error(e);
} }
catch(const std::runtime_error& e) { catch(const std::runtime_error& e) {
std::cerr << "(a2) Couldn't process event: " << e.what() << " codelocation = " << codeLocation << "\n"; SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (a2) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] (a2) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (a2) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
throw runtime_error(e.what()); throw runtime_error(e.what());
} }
catch(const std::exception& e) { catch(const std::exception& e) {
std::cerr << "(b) Couldn't process event: " << e.what() << " codelocation = " << codeLocation << "\n"; SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (b) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] (b) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (b) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
} }
catch(...) { catch(...) {
std::cerr << "(c) Couldn't process event: [UNKNOWN ERROR] " << " codelocation = " << codeLocation << "\n"; SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (c) Couldn't process event: [UNKNOWN ERROR] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,codeLocation.c_str());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] (c) Couldn't process event: [UNKNOWN ERROR] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,codeLocation.c_str()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (c) Couldn't process event: [UNKNOWN ERROR] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,codeLocation.c_str());
} }
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);

View File

@@ -152,6 +152,10 @@ void PlatformExceptionHandler::install(string dumpFileName){
//} //}
void message(string message){ void message(string message){
std::cerr << "******************************************************\n";
std::cerr << " " << message << "\n";
std::cerr << "******************************************************\n";
MessageBox(NULL, message.c_str(), "Message", MB_OK); MessageBox(NULL, message.c_str(), "Message", MB_OK);
} }

View File

@@ -374,7 +374,9 @@ bool SoundPlayerDs8::init(const SoundPlayerParams *params){
initOk = true; initOk = true;
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
} catch(const exception &ex) { }
catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
} }

View File

@@ -342,7 +342,9 @@ bool SoundPlayerOpenAL::init(const SoundPlayerParams* params) {
initOk = true; initOk = true;
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
} catch(const exception &ex) { }
catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
printOpenALInfo(); printOpenALInfo();
//throw std::runtime_error(ex.what()); //throw std::runtime_error(ex.what());
@@ -416,7 +418,9 @@ void SoundPlayerOpenAL::play(StaticSound* staticSound) {
if(source == 0) if(source == 0)
return; return;
source->play(staticSound); source->play(staticSound);
} catch(std::exception& e) { }
catch(std::exception& e) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
std::cerr << "Couldn't play static sound: " << e.what() << "\n"; std::cerr << "Couldn't play static sound: " << e.what() << "\n";
} }
} }
@@ -429,7 +433,9 @@ void SoundPlayerOpenAL::play(StrSound* strSound, int64 fadeOn) {
try { try {
StreamSoundSource* source = findStreamSoundSource(); StreamSoundSource* source = findStreamSoundSource();
source->play(strSound, fadeOn); source->play(strSound, fadeOn);
} catch(std::exception& e) { }
catch(std::exception& e) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
std::cerr << "Couldn't play streaming sound: " << e.what() << "\n"; std::cerr << "Couldn't play streaming sound: " << e.what() << "\n";
} }
} }
@@ -473,7 +479,10 @@ void SoundPlayerOpenAL::updateStreams() {
StreamSoundSource* source = *i; StreamSoundSource* source = *i;
try { try {
source->update(); source->update();
} catch(std::exception& e) { }
catch(std::exception& e) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
std::cerr << "Error while updating sound stream: " std::cerr << "Error while updating sound stream: "
<< e.what() << "\n"; << e.what() << "\n";
} }
@@ -481,6 +490,7 @@ void SoundPlayerOpenAL::updateStreams() {
alcProcessContext(context); alcProcessContext(context);
checkAlcError("Error while processing audio context: "); checkAlcError("Error while processing audio context: ");
} catch(...) { } catch(...) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] UNKNOWN Error\n",__FILE__,__FUNCTION__,__LINE__);
printOpenALInfo(); printOpenALInfo();
throw; throw;
} }

View File

@@ -100,6 +100,7 @@ bool Properties::getBool(const string &key, const char *defaultValueIfNotFound)
return strToBool(getString(key,defaultValueIfNotFound)); return strToBool(getString(key,defaultValueIfNotFound));
} }
catch(exception &e){ catch(exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error accessing value: " + key + " in: " + path+"\n[" + e.what() + "]"); throw runtime_error("Error accessing value: " + key + " in: " + path+"\n[" + e.what() + "]");
} }
} }
@@ -109,6 +110,7 @@ int Properties::getInt(const string &key,const char *defaultValueIfNotFound) con
return strToInt(getString(key,defaultValueIfNotFound)); return strToInt(getString(key,defaultValueIfNotFound));
} }
catch(exception &e){ catch(exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]"); throw runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]");
} }
} }
@@ -126,6 +128,7 @@ float Properties::getFloat(const string &key, const char *defaultValueIfNotFound
return strToFloat(getString(key,defaultValueIfNotFound)); return strToFloat(getString(key,defaultValueIfNotFound));
} }
catch(exception &e){ catch(exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]"); throw runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]");
} }
} }
@@ -189,6 +192,7 @@ bool Properties::getBool(const char *key, const char *defaultValueIfNotFound) co
return strToBool(getString(key,defaultValueIfNotFound)); return strToBool(getString(key,defaultValueIfNotFound));
} }
catch(exception &e){ catch(exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error accessing value: " + string(key) + " in: " + path+"\n[" + e.what() + "]"); throw runtime_error("Error accessing value: " + string(key) + " in: " + path+"\n[" + e.what() + "]");
} }
} }
@@ -198,6 +202,7 @@ int Properties::getInt(const char *key,const char *defaultValueIfNotFound) const
return strToInt(getString(key,defaultValueIfNotFound)); return strToInt(getString(key,defaultValueIfNotFound));
} }
catch(exception &e){ catch(exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]"); throw runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]");
} }
} }
@@ -207,6 +212,7 @@ float Properties::getFloat(const char *key, const char *defaultValueIfNotFound)
return strToFloat(getString(key,defaultValueIfNotFound)); return strToFloat(getString(key,defaultValueIfNotFound));
} }
catch(exception &e){ catch(exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]"); throw runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]");
} }
} }

View File

@@ -151,12 +151,13 @@ CURL *SystemFlags::initHTTP() {
void SystemFlags::init(bool haveSpecialOutputCommandLineOption) { void SystemFlags::init(bool haveSpecialOutputCommandLineOption) {
SystemFlags::haveSpecialOutputCommandLineOption = haveSpecialOutputCommandLineOption; SystemFlags::haveSpecialOutputCommandLineOption = haveSpecialOutputCommandLineOption;
if(SystemFlags::debugLogFileList.size() == 0) { if(SystemFlags::debugLogFileList.size() == 0) {
SystemFlags::debugLogFileList[SystemFlags::debugSystem] = SystemFlags::SystemFlagsType(SystemFlags::debugSystem); SystemFlags::debugLogFileList[SystemFlags::debugSystem] = SystemFlags::SystemFlagsType(SystemFlags::debugSystem);
SystemFlags::debugLogFileList[SystemFlags::debugNetwork] = SystemFlags::SystemFlagsType(SystemFlags::debugNetwork); SystemFlags::debugLogFileList[SystemFlags::debugNetwork] = SystemFlags::SystemFlagsType(SystemFlags::debugNetwork);
SystemFlags::debugLogFileList[SystemFlags::debugPerformance] = SystemFlags::SystemFlagsType(SystemFlags::debugPerformance); SystemFlags::debugLogFileList[SystemFlags::debugPerformance] = SystemFlags::SystemFlagsType(SystemFlags::debugPerformance);
SystemFlags::debugLogFileList[SystemFlags::debugWorldSynch] = SystemFlags::SystemFlagsType(SystemFlags::debugWorldSynch); SystemFlags::debugLogFileList[SystemFlags::debugWorldSynch] = SystemFlags::SystemFlagsType(SystemFlags::debugWorldSynch);
SystemFlags::debugLogFileList[SystemFlags::debugUnitCommands] = SystemFlags::SystemFlagsType(SystemFlags::debugUnitCommands); SystemFlags::debugLogFileList[SystemFlags::debugUnitCommands] = SystemFlags::SystemFlagsType(SystemFlags::debugUnitCommands);
SystemFlags::debugLogFileList[SystemFlags::debugLUA] = SystemFlags::SystemFlagsType(SystemFlags::debugLUA); SystemFlags::debugLogFileList[SystemFlags::debugLUA] = SystemFlags::SystemFlagsType(SystemFlags::debugLUA);
SystemFlags::debugLogFileList[SystemFlags::debugError] = SystemFlags::SystemFlagsType(SystemFlags::debugError);
} }
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
@@ -360,9 +361,12 @@ void SystemFlags::handleDebug(DebugType type, const char *fmt, ...) {
MutexSafeWrapper safeMutex(currentDebugLog.mutex); MutexSafeWrapper safeMutex(currentDebugLog.mutex);
if (type != debugPathFinder) { if (type != debugPathFinder && type != debugError) {
(*currentDebugLog.fileStream) << "[" << szBuf2 << "] " << szBuf; (*currentDebugLog.fileStream) << "[" << szBuf2 << "] " << szBuf;
} }
else if (type == debugError) {
(*currentDebugLog.fileStream) << "[" << szBuf2 << "] *ERROR* " << szBuf;
}
else { else {
(*currentDebugLog.fileStream) << szBuf; (*currentDebugLog.fileStream) << szBuf;
} }
@@ -372,9 +376,12 @@ void SystemFlags::handleDebug(DebugType type, const char *fmt, ...) {
} }
// output to console // output to console
else { else {
if (type != debugPathFinder) { if (type != debugPathFinder && type != debugError) {
printf("[%s] %s", szBuf2, szBuf); printf("[%s] %s", szBuf2, szBuf);
} }
else if (type == debugError) {
printf("[%s] *ERROR* %s", szBuf2, szBuf);
}
else { else {
printf("%s", szBuf); printf("%s", szBuf);
} }

View File

@@ -15,7 +15,7 @@
#include <stdexcept> #include <stdexcept>
#include "conversion.h" #include "conversion.h"
#include "util.h"
#include <xercesc/dom/DOM.hpp> #include <xercesc/dom/DOM.hpp>
#include <xercesc/util/PlatformUtils.hpp> #include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/framework/LocalFileFormatTarget.hpp> #include <xercesc/framework/LocalFileFormatTarget.hpp>
@@ -26,6 +26,7 @@
XERCES_CPP_NAMESPACE_USE XERCES_CPP_NAMESPACE_USE
using namespace std; using namespace std;
using namespace Shared::Util;
namespace Shared{ namespace Xml{ namespace Shared{ namespace Xml{
@@ -59,7 +60,8 @@ XmlIo::XmlIo(){
try{ try{
XMLPlatformUtils::Initialize(); XMLPlatformUtils::Initialize();
} }
catch(const XMLException&){ catch(const XMLException &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error initializing XML system\n",__FILE__,__FUNCTION__,__LINE__);
throw runtime_error("Error initializing XML system"); throw runtime_error("Error initializing XML system");
} }
@@ -69,7 +71,8 @@ XmlIo::XmlIo(){
implementation = DOMImplementationRegistry::getDOMImplementation(str); implementation = DOMImplementationRegistry::getDOMImplementation(str);
} }
catch(const DOMException){ catch(const DOMException &ex){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while creating XML parser\n",__FILE__,__FUNCTION__,__LINE__);
throw runtime_error("Exception while creating XML parser"); throw runtime_error("Exception while creating XML parser");
} }
} }
@@ -110,8 +113,9 @@ XmlNode *XmlIo::load(const string &path){
parser->release(); parser->release();
return rootNode; return rootNode;
} }
catch(const DOMException &e){ catch(const DOMException &ex) {
throw runtime_error("Exception while loading: " + path + ": " + XMLString::transcode(e.msg)); SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while loading: [%s], %s\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),XMLString::transcode(ex.msg));
throw runtime_error("Exception while loading: " + path + ": " + XMLString::transcode(ex.msg));
} }
} }
@@ -145,6 +149,7 @@ void XmlIo::save(const string &path, const XmlNode *node){
document->release(); document->release();
} }
catch(const DOMException &e){ catch(const DOMException &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while saving: [%s], %s\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),XMLString::transcode(e.msg));
throw runtime_error("Exception while saving: " + path + ": " + XMLString::transcode(e.msg)); throw runtime_error("Exception while saving: " + path + ": " + XMLString::transcode(e.msg));
} }
} }