From 93e2bccb0e1ca24c8172d9f03624bcf698aa6369 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 21 Feb 2021 19:16:53 +0000 Subject: [PATCH] Error reporting for submodels Also add some error codes I forgot for AI and traffic. --- simgear/debug/ErrorReportingCallback.hxx | 4 +++- simgear/scene/model/SGReaderWriterXML.cxx | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/simgear/debug/ErrorReportingCallback.hxx b/simgear/debug/ErrorReportingCallback.hxx index 5f55e1d8..2a2a210a 100644 --- a/simgear/debug/ErrorReportingCallback.hxx +++ b/simgear/debug/ErrorReportingCallback.hxx @@ -57,7 +57,9 @@ enum class ErrorCode { AudioFX, XMLLoadCommand, AircraftSystems, - InputDeviceConfig + InputDeviceConfig, + AITrafficSchedule, + AirportDataLoad // ground-net, jetways, etc }; /** @brief Define an error-reporting context value, for the duration of this diff --git a/simgear/scene/model/SGReaderWriterXML.cxx b/simgear/scene/model/SGReaderWriterXML.cxx index 8d897bbb..3edf9d8e 100644 --- a/simgear/scene/model/SGReaderWriterXML.cxx +++ b/simgear/scene/model/SGReaderWriterXML.cxx @@ -566,9 +566,12 @@ sgLoad3DModel_internal(const SGPath& path, if (!texturePathStr.empty()) { texturepath = SGModelLib::findDataFile(texturePathStr, NULL, modelDir); - if (texturepath.isNull()) + if (texturepath.isNull()) { + simgear::reportFailure(simgear::LoadFailure::NotFound, simgear::ErrorCode::LoadingTexture, + "Texture file not found:" + texturePathStr, path); throw sg_io_exception("Texture file not found: '" + texturePathStr + "'", path); + } } } } else { @@ -667,6 +670,9 @@ sgLoad3DModel_internal(const SGPath& path, if (submodelPath.isNull()) { SG_LOG(SG_IO, SG_DEV_ALERT, "Failed to load file: \"" << subPathStr << "\""); + simgear::reportFailure(simgear::LoadFailure::NotFound, simgear::ErrorCode::XMLModelLoad, + "Couldn't find file for submodel:" + subPathStr, + SGPath::fromUtf8(subPathStr)); continue; } @@ -679,6 +685,8 @@ sgLoad3DModel_internal(const SGPath& path, } } + simgear::ErrorReportContext("submodel", submodelPath.utf8Str()); + try { int num_anims; std::tie(num_anims, submodel) = sgLoad3DModel_internal(submodelPath, options.get(),