X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FConsole%2FExecutor.cc;h=1a93b6e95647e249e0ac976c5d5bf26f389ebb4d;hb=f2f5d59e83863f3b513950173baee1b6da2aee3c;hp=7733e072948b8b025cb0f702533932347d055628;hpb=a22f6d21df6c911d65f76d7731bcf92b1906bb09;p=senf.git diff --git a/Utils/Console/Executor.cc b/Utils/Console/Executor.cc index 7733e07..1a93b6e 100644 --- a/Utils/Console/Executor.cc +++ b/Utils/Console/Executor.cc @@ -41,7 +41,7 @@ namespace { - struct TraverseTokens { + struct TraversTokens { typedef std::string const & result_type; result_type operator()(senf::console::Token const & token) const { return token.value(); @@ -140,11 +140,11 @@ prefix_ void senf::console::Executor::execute(std::ostream & output, } } - catch (InvalidPathException &) { - throw SyntaxErrorException("invalid path"); + catch (InvalidPathException & ex) { + throw SyntaxErrorException("invalid path") << " '" << ex.path << "'"; } - catch (InvalidDirectoryException &) { - throw SyntaxErrorException("invalid directory"); + catch (InvalidDirectoryException & ex) { + throw SyntaxErrorException("invalid directory") << " '" << ex.path << "'"; } catch (InvalidCommandException &) { throw SyntaxErrorException("invalid command"); @@ -297,7 +297,12 @@ senf::console::Executor::traverseNode(ParseCommandInfo::TokensRange const & path return dir.back().lock()->get(name); } catch (UnknownNodeNameException &) { - throw InvalidPathException(); + throw InvalidPathException( + senf::stringJoin( + senf::make_transform_range( + boost::make_iterator_range(path.begin(), path.end()), + boost::bind(&Token::value, _1)), + "/")); } } @@ -305,10 +310,14 @@ prefix_ void senf::console::Executor::traverseDirectory(ParseCommandInfo::TokensRange const & path, Path & dir) { + std::string errorPath; try { ParseCommandInfo::TokensRange::const_iterator i (path.begin()); ParseCommandInfo::TokensRange::const_iterator const i_end (path.end()); for (; i != i_end; ++i) { + if (i != path.begin()) + errorPath += "/"; + errorPath += i->value(); if (*i == NoneToken()) { if (i == path.begin()) { dir.clear(); @@ -331,10 +340,10 @@ senf::console::Executor::traverseDirectory(ParseCommandInfo::TokensRange const & } } catch (std::bad_cast &) { - throw InvalidDirectoryException(); + throw InvalidDirectoryException(errorPath); } catch (UnknownNodeNameException &) { - throw InvalidDirectoryException(); + throw InvalidDirectoryException(errorPath); } }