use exceptions in FML

This commit is contained in:
Eduardo Bart
2011-05-21 19:24:10 -03:00
parent c3e67fceb9
commit d7bc083014
14 changed files with 306 additions and 175 deletions

View File

@@ -77,8 +77,8 @@ bool Font::load(const std::string& file)
std::string textureName;
Size glyphSize;
FML::Parser parser(fin);
if(!parser.hasError()) {
try {
FML::Parser parser(fin, file);
FML::Node* doc = parser.getDocument();
// required values
@@ -115,8 +115,8 @@ bool Font::load(const std::string& file)
m_glyphsSize[glyph].width(),
m_glyphHeight);
}
} else {
flogError("ERROR: Malformed font file \"%s\":\n %s", file.c_str() % parser.getErrorMessage());
} catch(FML::Exception e) {
flogError("ERROR: Malformed font file \"%s\":\n %s", file.c_str() % e.what());
return false;
}