From e365b82e67f910ecf31624809587aba4cfcc2dd8 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Fri, 19 Oct 2018 15:30:05 +0200 Subject: [PATCH] fix error reporting of string parser --- alib2str/src/registry/StringReaderRegistry.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/alib2str/src/registry/StringReaderRegistry.cpp b/alib2str/src/registry/StringReaderRegistry.cpp index 710f131a52..5946424596 100644 --- a/alib2str/src/registry/StringReaderRegistry.cpp +++ b/alib2str/src/registry/StringReaderRegistry.cpp @@ -16,10 +16,15 @@ std::shared_ptr < abstraction::OperationAbstraction > StringReaderRegistry::getA return entry.first ( ss ); }; - const auto & entries = getEntries ( ) [ group ]; + const auto & entryIterator = getEntries ( ).find ( group ); + if ( entryIterator == getEntries ( ).end ( ) ) + throw exception::CommonException ( "Entry " + group + " not available." ); + + const auto & entries = entryIterator->second; + typename ext::deque < std::pair < std::function < bool ( std::istream & ) >, std::unique_ptr < Entry > > >::const_iterator callback = find_if ( entries.begin ( ), entries.end ( ), lambda ); if ( callback == entries.end ( ) ) - throw exception::CommonException ( "Entry " + group + " not available." ); + throw exception::CommonException ( "No callback handling input found." ); return callback->second->getAbstraction ( ); } -- GitLab