make otml simpler and easier to use, improve error handling/exceptions

This commit is contained in:
Eduardo Bart
2011-08-19 15:53:23 -03:00
parent f9e7d52ac0
commit 033f14780d
32 changed files with 646 additions and 622 deletions

View File

@@ -20,9 +20,9 @@ bool FontManager::importFont(std::string fontFile)
OTMLDocumentPtr doc = OTMLDocument::parse(fontFile);
OTMLNodePtr fontNode = doc->at("Font");
std::string name = fontNode->readAt<std::string>("name");
std::string name = fontNode->valueAt("name");
if(fontExists(name))
throw OTMLException(fontNode, "a font with the same name is already imported, did you duplicate font names?");
throw std::runtime_error("a font with the same name is already imported, did you duplicate font names?");
FontPtr font(new Font(name));
font->load(fontNode);
@@ -34,7 +34,7 @@ bool FontManager::importFont(std::string fontFile)
return true;
} catch(std::exception& e) {
logError("ERROR: could not load font '", fontFile, "': ", e.what());
logError("ERROR: could not load font from '", fontFile, "': ", e.what());
return false;
}
}