Error handling
This commit is contained in:
parent
f8d57bece3
commit
28bcf81626
|
@ -186,6 +186,10 @@ void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtre
|
||||||
displayInHud=true;
|
displayInHud=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch(megaglest_runtime_error& ex) {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||||
|
throw megaglest_runtime_error("Error loading resource type: "+ path + "\nMessage: " + ex.what(),!ex.wantStackTrace());
|
||||||
|
}
|
||||||
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::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
|
||||||
throw megaglest_runtime_error("Error loading resource type: " + path + "\n" + e.what());
|
throw megaglest_runtime_error("Error loading resource type: " + path + "\n" + e.what());
|
||||||
|
|
|
@ -482,13 +482,12 @@ void SkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
|
||||||
animationAttributes.push_back(animationAttributeList);
|
animationAttributes.push_back(animationAttributeList);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line %d] WARNING CANNOT LOAD MODEL [%s] for parentLoader [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),parentLoader.c_str());
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line %d] ERROR CANNOT LOAD MODEL [%s] for parentLoader [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),parentLoader.c_str());
|
||||||
|
throw megaglest_runtime_error("Error: cannot load model ["+path+"] for skill ["+name+"] ",true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(animations.empty() == true) {
|
if(animations.empty() == true) {
|
||||||
char szBuf[8096]="";
|
throw megaglest_runtime_error("Error no animations found for skill ["+name+"] for parentLoader ["+parentLoader+"]",true);
|
||||||
snprintf(szBuf,8096,"Error no animations found for skill [%s] for parentLoader [%s]",name.c_str(),parentLoader.c_str());
|
|
||||||
throw megaglest_runtime_error(szBuf,true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1057,9 +1057,13 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
|
||||||
//values
|
//values
|
||||||
UpgradeTypeBase::load(upgradeNode,name);
|
UpgradeTypeBase::load(upgradeNode,name);
|
||||||
}
|
}
|
||||||
|
catch(megaglest_runtime_error& ex) {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||||
|
throw megaglest_runtime_error("Error loading UpgradeType: "+ currentPath + "\nMessage: " + ex.what(),!ex.wantStackTrace() );
|
||||||
|
}
|
||||||
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::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
|
||||||
throw megaglest_runtime_error("Error loading UpgradeType: "+ dir + "\n" +e.what());
|
throw megaglest_runtime_error("Error loading UpgradeType: "+ currentPath + "\n" +e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
|
@ -136,7 +136,7 @@ Checksum Tileset::loadTileset(const vector<string> pathList, const string &tiles
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(found == false) {
|
if(found == false) {
|
||||||
throw megaglest_runtime_error("Error could not find tileset [" + tilesetName + "]\n");
|
throw megaglest_runtime_error("Error could not find tileset [" + tilesetName + "]\n",true);
|
||||||
|
|
||||||
}
|
}
|
||||||
return tilesetChecksum;
|
return tilesetChecksum;
|
||||||
|
@ -251,6 +251,10 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
|
||||||
width = pixmap->getW();
|
width = pixmap->getW();
|
||||||
height = pixmap->getW();
|
height = pixmap->getW();
|
||||||
}
|
}
|
||||||
|
catch(megaglest_runtime_error& ex) {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||||
|
throw megaglest_runtime_error("Error loading tileset: "+ path + "\nMessage: " + ex.what(),!ex.wantStackTrace() );
|
||||||
|
}
|
||||||
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::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||||
|
|
||||||
|
@ -491,7 +495,11 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
|
||||||
|
|
||||||
}
|
}
|
||||||
//Exception handling (conversions and so on);
|
//Exception handling (conversions and so on);
|
||||||
catch(const exception &e) {
|
catch(megaglest_runtime_error& ex) {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||||
|
throw megaglest_runtime_error("Error loading tileset: "+ path + "\nMessage: " + ex.what(),!ex.wantStackTrace() );
|
||||||
|
}
|
||||||
|
catch(const exception &e) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
|
||||||
throw megaglest_runtime_error("Error: " + path + "\n" + e.what());
|
throw megaglest_runtime_error("Error: " + path + "\n" + e.what());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue