summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-02-13 20:18:33 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-02-13 20:18:33 +0100
commite558909fcfea06a2f7517d760417f52f274c0db9 (patch)
tree6f413b98af04dce894311d899b975baa0bc9ee3a /src
parent31dafd4ba6374707edca1c72d9e7f37d03c45f9d (diff)
improved error messages of DocumentChildHandler::data
Diffstat (limited to 'src')
-rw-r--r--src/core/parser/stack/DocumentHandler.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/core/parser/stack/DocumentHandler.cpp b/src/core/parser/stack/DocumentHandler.cpp
index b47b3d4..ba7430d 100644
--- a/src/core/parser/stack/DocumentHandler.cpp
+++ b/src/core/parser/stack/DocumentHandler.cpp
@@ -21,6 +21,7 @@
#include <algorithm>
#include <core/common/RttiBuilder.hpp>
+#include <core/common/Utils.hpp>
#include <core/model/Document.hpp>
#include <core/model/Domain.hpp>
#include <core/model/Typesystem.hpp>
@@ -218,12 +219,13 @@ void DocumentChildHandler::data(const std::string &data, int fieldIdx)
*/
// retrieve all fields.
NodeVector<FieldDescriptor> fields = desc->getDefaultFields();
+ std::vector<LoggerFork> forks;
for (auto field : fields) {
// then try to parse the content using the type specification.
- LoggerFork loggerFork = logger().fork();
- auto res = convertData(field, loggerFork, data);
+ forks.emplace_back(logger().fork());
+ auto res = convertData(field, forks.back(), data);
if (res.first) {
- loggerFork.commit();
+ forks.back().commit();
// if that worked, construct the necessary path.
auto pathRes = desc->pathTo(field, logger());
assert(pathRes.second);
@@ -234,9 +236,12 @@ void DocumentChildHandler::data(const std::string &data, int fieldIdx)
return;
}
}
- logger().error(
- "Could not read the data with any of the possible fields.",
- location());
+ logger().error("Could not read data with any of the possible fields:");
+ for (size_t f = 0; f < fields.size(); f++) {
+ logger().note(Utils::join(fields[f]->path(), ".") + ":",
+ SourceLocation{}, MessageMode::NO_CONTEXT);
+ forks[f].commit();
+ }
}
}