From a1b5f452e33b96e4feed0ad5dd2a4519f636890c Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 21 Apr 2021 21:56:52 +0100 Subject: [PATCH] Input-device configuration: report config errors --- src/Input/FGDeviceConfigurationMap.cxx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Input/FGDeviceConfigurationMap.cxx b/src/Input/FGDeviceConfigurationMap.cxx index 9f618fcc0..0ce2f2331 100644 --- a/src/Input/FGDeviceConfigurationMap.cxx +++ b/src/Input/FGDeviceConfigurationMap.cxx @@ -97,13 +97,16 @@ FGDeviceConfigurationMap::configurationForDeviceName(const std::string& name) SGPropertyNode_ptr result(new SGPropertyNode); try { - readProperties(it->second, result); - result->setStringValue("source", it->second.utf8Str()); - } catch (sg_exception&) { - SG_LOG(SG_INPUT, SG_WARN, "parse failure reading:" << it->second); - return {}; + flightgear::SentryXMLErrorSupression xs; + readProperties(it->second, result); + result->setStringValue("source", it->second.utf8Str()); + } catch (sg_exception& e) { + simgear::reportFailure(simgear::LoadFailure::BadData, simgear::ErrorCode::InputDeviceConfig, + "Failed to parse device configuration:" + e.getFormattedMessage(), + it->second); + return {}; } - + return result; } @@ -168,7 +171,6 @@ void FGDeviceConfigurationMap::refreshCacheForFile(const SGPath& path) try { readProperties(path, n); } catch (sg_exception& e) { - SG_LOG(SG_INPUT, SG_ALERT, "parse failure reading:" << path); simgear::reportFailure(simgear::LoadFailure::BadData, simgear::ErrorCode::InputDeviceConfig, "Failed to load input device configuration:" + e.getFormattedMessage(), path);