Error reporting for submodels

Also add some error codes I forgot for AI and traffic.
This commit is contained in:
James Turner
2021-02-21 19:16:53 +00:00
committed by Automatic Release Builder
parent d8d64b2367
commit 32f69df774
2 changed files with 12 additions and 2 deletions

View File

@@ -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

View File

@@ -323,9 +323,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 {
@@ -426,6 +429,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;
}
@@ -438,6 +444,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(),