1
0
Fork 0

Nasal: reduce exceptions from loadxml()

When the file path is not preset, check for this and don’t let
readProperties() fail with an exception, since this makes for very
noisy event reporting.
This commit is contained in:
Automatic Release Builder 2020-09-26 11:36:08 +01:00 committed by James Turner
parent d803875997
commit 39bc7f2acd

View file

@ -756,6 +756,11 @@ do_load_xml_to_proptree(const SGPropertyNode * arg, SGPropertyNode * root)
} }
} }
if (!file.exists()) {
SG_LOG(SG_IO, SG_WARN, "loadxml: no such file:" << file);
return false;
}
SGPath validated_path = fgValidatePath(file, false); SGPath validated_path = fgValidatePath(file, false);
if (validated_path.isNull()) { if (validated_path.isNull()) {
SG_LOG(SG_IO, SG_ALERT, "loadxml: reading '" << file << "' denied " SG_LOG(SG_IO, SG_ALERT, "loadxml: reading '" << file << "' denied "
@ -772,7 +777,7 @@ do_load_xml_to_proptree(const SGPropertyNode * arg, SGPropertyNode * root)
try { try {
readProperties(validated_path, targetnode, true); readProperties(validated_path, targetnode, true);
} catch (const sg_exception &e) { } catch (const sg_exception &e) {
SG_LOG(SG_IO, SG_WARN, "loadxml: " << e.getFormattedMessage()); SG_LOG(SG_IO, SG_WARN, "loadxml exception: " << e.getFormattedMessage());
return false; return false;
} }