mirror of
https://github.com/glest/glest-source.git
synced 2025-08-16 13:23:59 +02:00
- 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:
@@ -71,9 +71,9 @@ public:
|
||||
void setFloat(const string &key, float value);
|
||||
void setString(const string &key, const string &value);
|
||||
|
||||
string getpath() const { return path;}
|
||||
|
||||
string toString();
|
||||
|
||||
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
@@ -44,6 +44,7 @@ public:
|
||||
debugUnitCommands,
|
||||
debugPathFinder,
|
||||
debugLUA,
|
||||
debugError
|
||||
};
|
||||
|
||||
class SystemFlagsType
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// ==============================================================
|
||||
// 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
|
||||
// the terms of the GNU General Public License as published
|
||||
@@ -493,6 +493,7 @@ void Model::loadG3d(const string &path){
|
||||
fclose(f);
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
@@ -68,36 +68,49 @@ LuaScript::~LuaScript() {
|
||||
void LuaScript::loadCode(const string &code, const string &name){
|
||||
Lua_STREFLOP_Wrapper streflopWrapper;
|
||||
|
||||
int errorCode= luaL_loadbuffer(luaState, code.c_str(), code.size(), name.c_str());
|
||||
if(errorCode!=0){
|
||||
int errorCode= luaL_loadbuffer(luaState, code.c_str(), code.length(), name.c_str());
|
||||
if(errorCode !=0 ) {
|
||||
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
|
||||
errorCode= lua_pcall(luaState, 0, 0, 0)!=0;
|
||||
if(errorCode!=0){
|
||||
errorCode= lua_pcall(luaState, 0, 0, 0);
|
||||
if(errorCode !=0 ) {
|
||||
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){
|
||||
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());
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void LuaScript::endCall(){
|
||||
Lua_STREFLOP_Wrapper streflopWrapper;
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
lua_pcall(luaState, argumentCount, 0, 0);
|
||||
}
|
||||
|
||||
void LuaScript::registerFunction(LuaFunction luaFunction, const string &functionName) {
|
||||
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_setglobal(luaState, functionName.c_str());
|
||||
}
|
||||
|
@@ -59,10 +59,12 @@ void FileCRCPreCacheThread::execute() {
|
||||
}
|
||||
}
|
||||
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());
|
||||
setRunningStatus(false);
|
||||
}
|
||||
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__);
|
||||
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());
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
|
||||
setRunningStatus(false);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str());
|
||||
|
@@ -1560,10 +1560,12 @@ void BroadCastClientSocketThread::execute() {
|
||||
}
|
||||
}
|
||||
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());
|
||||
//setRunningStatus(false);
|
||||
}
|
||||
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__);
|
||||
//setRunningStatus(false);
|
||||
}
|
||||
@@ -1886,11 +1888,13 @@ void BroadCastSocketThread::execute() {
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
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());
|
||||
this->setQuitStatus(true);
|
||||
//setRunningStatus(false);
|
||||
}
|
||||
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__);
|
||||
this->setQuitStatus(true);
|
||||
//setRunningStatus(false);
|
||||
|
@@ -272,22 +272,22 @@ bool Window::handleEvent() {
|
||||
}
|
||||
}
|
||||
catch(const char *e){
|
||||
std::cerr << "(a1) Couldn't process event: " << e << " codelocation = " << codeLocation << "\n";
|
||||
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::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 Line: %d] (a1) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e,codeLocation.c_str());
|
||||
throw runtime_error(e);
|
||||
}
|
||||
catch(const std::runtime_error& e) {
|
||||
std::cerr << "(a2) Couldn't process event: " << e.what() << " codelocation = " << codeLocation << "\n";
|
||||
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::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 Line: %d] (a2) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
|
||||
throw runtime_error(e.what());
|
||||
}
|
||||
catch(const std::exception& e) {
|
||||
std::cerr << "(b) Couldn't process event: " << e.what() << " codelocation = " << codeLocation << "\n";
|
||||
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::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 Line: %d] (b) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
|
||||
}
|
||||
catch(...) {
|
||||
std::cerr << "(c) Couldn't process event: [UNKNOWN ERROR] " << " codelocation = " << codeLocation << "\n";
|
||||
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::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 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__);
|
||||
|
@@ -152,6 +152,10 @@ void PlatformExceptionHandler::install(string dumpFileName){
|
||||
//}
|
||||
|
||||
void message(string message){
|
||||
std::cerr << "******************************************************\n";
|
||||
std::cerr << " " << message << "\n";
|
||||
std::cerr << "******************************************************\n";
|
||||
|
||||
MessageBox(NULL, message.c_str(), "Message", MB_OK);
|
||||
}
|
||||
|
||||
|
@@ -374,7 +374,9 @@ bool SoundPlayerDs8::init(const SoundPlayerParams *params){
|
||||
initOk = true;
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
@@ -342,7 +342,9 @@ bool SoundPlayerOpenAL::init(const SoundPlayerParams* params) {
|
||||
|
||||
initOk = true;
|
||||
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());
|
||||
printOpenALInfo();
|
||||
//throw std::runtime_error(ex.what());
|
||||
@@ -416,7 +418,9 @@ void SoundPlayerOpenAL::play(StaticSound* staticSound) {
|
||||
if(source == 0)
|
||||
return;
|
||||
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";
|
||||
}
|
||||
}
|
||||
@@ -429,7 +433,9 @@ void SoundPlayerOpenAL::play(StrSound* strSound, int64 fadeOn) {
|
||||
try {
|
||||
StreamSoundSource* source = findStreamSoundSource();
|
||||
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";
|
||||
}
|
||||
}
|
||||
@@ -473,7 +479,10 @@ void SoundPlayerOpenAL::updateStreams() {
|
||||
StreamSoundSource* source = *i;
|
||||
try {
|
||||
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: "
|
||||
<< e.what() << "\n";
|
||||
}
|
||||
@@ -481,6 +490,7 @@ void SoundPlayerOpenAL::updateStreams() {
|
||||
alcProcessContext(context);
|
||||
checkAlcError("Error while processing audio context: ");
|
||||
} catch(...) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] UNKNOWN Error\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
printOpenALInfo();
|
||||
throw;
|
||||
}
|
||||
|
@@ -100,6 +100,7 @@ bool Properties::getBool(const string &key, const char *defaultValueIfNotFound)
|
||||
return strToBool(getString(key,defaultValueIfNotFound));
|
||||
}
|
||||
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() + "]");
|
||||
}
|
||||
}
|
||||
@@ -109,6 +110,7 @@ int Properties::getInt(const string &key,const char *defaultValueIfNotFound) con
|
||||
return strToInt(getString(key,defaultValueIfNotFound));
|
||||
}
|
||||
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() + "]");
|
||||
}
|
||||
}
|
||||
@@ -126,6 +128,7 @@ float Properties::getFloat(const string &key, const char *defaultValueIfNotFound
|
||||
return strToFloat(getString(key,defaultValueIfNotFound));
|
||||
}
|
||||
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() + "]");
|
||||
}
|
||||
}
|
||||
@@ -189,6 +192,7 @@ bool Properties::getBool(const char *key, const char *defaultValueIfNotFound) co
|
||||
return strToBool(getString(key,defaultValueIfNotFound));
|
||||
}
|
||||
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() + "]");
|
||||
}
|
||||
}
|
||||
@@ -198,6 +202,7 @@ int Properties::getInt(const char *key,const char *defaultValueIfNotFound) const
|
||||
return strToInt(getString(key,defaultValueIfNotFound));
|
||||
}
|
||||
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() + "]");
|
||||
}
|
||||
}
|
||||
@@ -207,6 +212,7 @@ float Properties::getFloat(const char *key, const char *defaultValueIfNotFound)
|
||||
return strToFloat(getString(key,defaultValueIfNotFound));
|
||||
}
|
||||
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() + "]");
|
||||
}
|
||||
}
|
||||
|
@@ -151,12 +151,13 @@ CURL *SystemFlags::initHTTP() {
|
||||
void SystemFlags::init(bool haveSpecialOutputCommandLineOption) {
|
||||
SystemFlags::haveSpecialOutputCommandLineOption = haveSpecialOutputCommandLineOption;
|
||||
if(SystemFlags::debugLogFileList.size() == 0) {
|
||||
SystemFlags::debugLogFileList[SystemFlags::debugSystem] = SystemFlags::SystemFlagsType(SystemFlags::debugSystem);
|
||||
SystemFlags::debugLogFileList[SystemFlags::debugNetwork] = SystemFlags::SystemFlagsType(SystemFlags::debugNetwork);
|
||||
SystemFlags::debugLogFileList[SystemFlags::debugPerformance] = SystemFlags::SystemFlagsType(SystemFlags::debugPerformance);
|
||||
SystemFlags::debugLogFileList[SystemFlags::debugWorldSynch] = SystemFlags::SystemFlagsType(SystemFlags::debugWorldSynch);
|
||||
SystemFlags::debugLogFileList[SystemFlags::debugUnitCommands] = SystemFlags::SystemFlagsType(SystemFlags::debugUnitCommands);
|
||||
SystemFlags::debugLogFileList[SystemFlags::debugLUA] = SystemFlags::SystemFlagsType(SystemFlags::debugLUA);
|
||||
SystemFlags::debugLogFileList[SystemFlags::debugSystem] = SystemFlags::SystemFlagsType(SystemFlags::debugSystem);
|
||||
SystemFlags::debugLogFileList[SystemFlags::debugNetwork] = SystemFlags::SystemFlagsType(SystemFlags::debugNetwork);
|
||||
SystemFlags::debugLogFileList[SystemFlags::debugPerformance] = SystemFlags::SystemFlagsType(SystemFlags::debugPerformance);
|
||||
SystemFlags::debugLogFileList[SystemFlags::debugWorldSynch] = SystemFlags::SystemFlagsType(SystemFlags::debugWorldSynch);
|
||||
SystemFlags::debugLogFileList[SystemFlags::debugUnitCommands] = SystemFlags::SystemFlagsType(SystemFlags::debugUnitCommands);
|
||||
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__);
|
||||
@@ -360,9 +361,12 @@ void SystemFlags::handleDebug(DebugType type, const char *fmt, ...) {
|
||||
|
||||
MutexSafeWrapper safeMutex(currentDebugLog.mutex);
|
||||
|
||||
if (type != debugPathFinder) {
|
||||
if (type != debugPathFinder && type != debugError) {
|
||||
(*currentDebugLog.fileStream) << "[" << szBuf2 << "] " << szBuf;
|
||||
}
|
||||
else if (type == debugError) {
|
||||
(*currentDebugLog.fileStream) << "[" << szBuf2 << "] *ERROR* " << szBuf;
|
||||
}
|
||||
else {
|
||||
(*currentDebugLog.fileStream) << szBuf;
|
||||
}
|
||||
@@ -372,9 +376,12 @@ void SystemFlags::handleDebug(DebugType type, const char *fmt, ...) {
|
||||
}
|
||||
// output to console
|
||||
else {
|
||||
if (type != debugPathFinder) {
|
||||
if (type != debugPathFinder && type != debugError) {
|
||||
printf("[%s] %s", szBuf2, szBuf);
|
||||
}
|
||||
else if (type == debugError) {
|
||||
printf("[%s] *ERROR* %s", szBuf2, szBuf);
|
||||
}
|
||||
else {
|
||||
printf("%s", szBuf);
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
#include <stdexcept>
|
||||
|
||||
#include "conversion.h"
|
||||
|
||||
#include "util.h"
|
||||
#include <xercesc/dom/DOM.hpp>
|
||||
#include <xercesc/util/PlatformUtils.hpp>
|
||||
#include <xercesc/framework/LocalFileFormatTarget.hpp>
|
||||
@@ -26,6 +26,7 @@
|
||||
XERCES_CPP_NAMESPACE_USE
|
||||
|
||||
using namespace std;
|
||||
using namespace Shared::Util;
|
||||
|
||||
namespace Shared{ namespace Xml{
|
||||
|
||||
@@ -59,7 +60,8 @@ XmlIo::XmlIo(){
|
||||
try{
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -69,7 +71,8 @@ XmlIo::XmlIo(){
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -110,8 +113,9 @@ XmlNode *XmlIo::load(const string &path){
|
||||
parser->release();
|
||||
return rootNode;
|
||||
}
|
||||
catch(const DOMException &e){
|
||||
throw runtime_error("Exception while loading: " + path + ": " + XMLString::transcode(e.msg));
|
||||
catch(const DOMException &ex) {
|
||||
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();
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user