diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-04 15:46:20 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-04 15:46:20 +0100 |
commit | f406236863419349508c9f74c7a7bc8893e8fe3a (patch) | |
tree | 22a73ea723f312653b1f3d49e505155fe45523fe /src/core/parser/ParserScope.cpp | |
parent | 9a5ca5397cc7903728e808c861f0a7fe1198bb43 (diff) | |
parent | a8a911a73793d42f8d39d7a1babf4eb4a9965a5e (diff) |
Merge branch 'master' of somweyr.de:ousia
Conflicts:
application/src/plugins/xml/XmlParser.cpp
Diffstat (limited to 'src/core/parser/ParserScope.cpp')
-rw-r--r-- | src/core/parser/ParserScope.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/core/parser/ParserScope.cpp b/src/core/parser/ParserScope.cpp index 1937697..b97dabd 100644 --- a/src/core/parser/ParserScope.cpp +++ b/src/core/parser/ParserScope.cpp @@ -90,10 +90,23 @@ Rooted<Node> ParserScopeBase::select(RttiSet types, int maxDepth) return nodes[i]; } } - throw LoggableException{ - std::string( - "Expected be inside an element of one of the internal types ") + - Utils::join(types, "\", \"", "\"", "\"")}; + return nullptr; +} + +Rooted<Node> ParserScopeBase::selectOrThrow(RttiSet types, int maxDepth) +{ + Rooted<Node> res = select(types, maxDepth); + if (res == nullptr) { + std::vector<std::string> typenames; + for (auto type : types) { + typenames.push_back(type->name); + } + throw LoggableException{std::string( + "Expected to be inside an element of one " + "of the internal types ") + + Utils::join(typenames, "\", \"", "\"", "\"")}; + } + return res; } /* Class DeferredResolution */ |