From 8722ea0fb64b9cd9d42ddb5e646fa776adebd9f7 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 6 Feb 2022 10:55:58 +0000 Subject: [PATCH] Model animation loading errors Another fix, for a different exception type, spotted by Michael D. SF-ID: https://sourceforge.net/p/flightgear/codetickets/2702/ --- simgear/scene/model/SGReaderWriterXML.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/simgear/scene/model/SGReaderWriterXML.cxx b/simgear/scene/model/SGReaderWriterXML.cxx index c92173d4..55de8b19 100644 --- a/simgear/scene/model/SGReaderWriterXML.cxx +++ b/simgear/scene/model/SGReaderWriterXML.cxx @@ -824,12 +824,20 @@ sgLoad3DModel_internal(const SGPath& path, /// OSGFIXME: duh, why not only model????? SGAnimation::animate(modelData); + + // note from James: we used to re-throw these errors, and they + // were caught one level up as an SG_DEV_ALERT log message and + // loading an empty osg::Node for the entire model. + // Chosing instead to trap them there, since a single failed animation + // isn't necessarily a reason to abandon the model load. } catch (sg_exception& e) { - simgear::reportFailure(simgear::LoadFailure::NotFound, simgear::ErrorCode::XMLModelLoad, - "Couldn't load animation " + animation_nodes[i]->getNameString() - + ":" + e.getFormattedMessage(), + simgear::reportFailure(simgear::LoadFailure::Misconfigured, simgear::ErrorCode::XMLModelLoad, + "Couldn't load animation " + animation_nodes[i]->getNameString() + ":" + e.getFormattedMessage(), + modelpath); + } catch (std::exception& e) { // needed because props throws std::runtime_error sometimes + simgear::reportFailure(simgear::LoadFailure::Misconfigured, simgear::ErrorCode::XMLModelLoad, + "Couldn't load animation " + animation_nodes[i]->getNameString() + ":" + e.what(), modelpath); - throw; } }