From 01eb8253196672c969a39587e90b49321a182428 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:19:14 +0200 Subject: 5.1 --- lib/xml_base.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'lib/xml_base.cpp') diff --git a/lib/xml_base.cpp b/lib/xml_base.cpp index e6b1e840..10bb698a 100644 --- a/lib/xml_base.cpp +++ b/lib/xml_base.cpp @@ -63,13 +63,17 @@ void xmlAccess::loadXmlDocument(const Zstring& filename, XmlDoc& doc) //throw Ff const std::wstring xmlAccess::getErrorMessageFormatted(const XmlIn& in) { - std::wstring errorMessage = _("Could not read values for the following XML nodes:") + L"\n"; + std::wstring msg; - std::vector failedNodes = in.getErrorsAs(); - std::for_each(failedNodes.begin(), failedNodes.end(), - [&](const std::wstring& str) { errorMessage += str + L'\n'; }); + const auto& failedElements = in.getErrorsAs(); + if (!failedElements.empty()) + { + msg = _("Cannot read the following XML elements:") + L"\n"; + std::for_each(failedElements.begin(), failedElements.end(), + [&](const std::wstring& str) { msg += str + L'\n'; }); + } - return errorMessage; + return msg; } -- cgit