summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-02-17 19:37:45 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-02-17 19:37:45 +0100
commitafd223129824babe74399cd340ca7838d2910863 (patch)
tree2834d32e1bef9d32bbd9546b18be98d481e32094
parentbf5f5e97d7bb40fd8da4b45dde9aa1bb23105af4 (diff)
Improved error messages in case no primitive field is present, but data is given
-rw-r--r--src/core/parser/stack/DocumentHandler.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/core/parser/stack/DocumentHandler.cpp b/src/core/parser/stack/DocumentHandler.cpp
index 49bf26b..7fd2d8c 100644
--- a/src/core/parser/stack/DocumentHandler.cpp
+++ b/src/core/parser/stack/DocumentHandler.cpp
@@ -383,16 +383,24 @@ bool DocumentChildHandler::data(Variant &data)
}
// No field was found that might take the data -- dump the error messages
- // from the loggers
- logger().error("Could not read data with any of the possible fields:",
- SourceLocation{}, MessageMode::NO_CONTEXT);
- size_t f = 0;
- for (auto field : defaultFields) {
- logger().note(std::string("Field ") + Utils::join(field->path(), ".") +
- std::string(":"),
- SourceLocation{}, MessageMode::NO_CONTEXT);
- forks[f].commit();
- f++;
+ // from the loggers -- or, if there were no primitive fields, clearly state
+ // this fact
+ if (defaultFields.empty()) {
+ logger().error("Got data, but structure \"" + name() +
+ "\" does not have any primitive field",
+ data);
+ } else {
+ logger().error("Could not read data with any of the possible fields:",
+ data);
+ size_t f = 0;
+ for (auto field : defaultFields) {
+ logger().note(std::string("Field ") +
+ Utils::join(field->path(), ".") +
+ std::string(":"),
+ SourceLocation{}, MessageMode::NO_CONTEXT);
+ forks[f].commit();
+ f++;
+ }
}
return false;
}
@@ -417,4 +425,4 @@ namespace RttiTypes {
const Rtti DocumentField = RttiBuilder<ousia::parser_stack::DocumentField>(
"DocumentField").parent(&Node);
}
-} \ No newline at end of file
+}