collada_urdf: writeDocument now throws instead of returning bool

This commit is contained in:
tfield 2010-04-23 22:27:52 +00:00
parent 51a5c72b31
commit 275955babf
3 changed files with 5 additions and 5 deletions

View File

@ -95,8 +95,9 @@ public:
* *
* \param documentName The filename of the document to write to * \param documentName The filename of the document to write to
* \return True if the file was successfully written * \return True if the file was successfully written
* \throws ColladaWriterException if an error occurred writing the COLLADA file
*/ */
bool writeDocument(std::string const& documentName); void writeDocument(std::string const& documentName);
protected: protected:
virtual void handleError(daeString msg); virtual void handleError(daeString msg);

View File

@ -70,7 +70,7 @@ ColladaWriter::ColladaWriter(shared_ptr<urdf::Model> robot, string const& source
{ {
} }
bool ColladaWriter::writeDocument(string const& documentName) { void ColladaWriter::writeDocument(string const& documentName) {
initDocument(documentName); initDocument(documentName);
SCENE scene = createScene(); SCENE scene = createScene();
@ -83,8 +83,6 @@ bool ColladaWriter::writeDocument(string const& documentName) {
addBindings(scene); addBindings(scene);
collada_->writeAll(); collada_->writeAll();
return true;
} }
ColladaWriter::~ColladaWriter() { ColladaWriter::~ColladaWriter() {

View File

@ -31,7 +31,8 @@
TEST(collada_urdf, collada_writer_writes) TEST(collada_urdf, collada_writer_writes)
{ {
ASSERT_TRUE(collada_urdf::ColladaWriter("test/pr2.urdf").writeDocument("test/pr2.dae")); // An exception will be thrown on any error opening the URDF or writing the COLLADA file
collada_urdf::ColladaWriter("test/pr2.urdf").writeDocument("test/pr2.dae");
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {