From ec6306ad1e746d47ed66af6274fb6710c70933a2 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Tue, 3 Feb 2015 22:54:17 +0100 Subject: Fixed XML-Importer failing --- src/core/parser/ParserScope.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/core/parser/ParserScope.cpp') 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 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 ParserScopeBase::selectOrThrow(RttiSet types, int maxDepth) +{ + Rooted res = select(types, maxDepth); + if (res == nullptr) { + std::vector 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 */ -- cgit v1.2.3