diff options
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 */ |