Utils/Console: Fix DirectoryNode::add(...) API
[senf.git] / senf / Utils / Console / Executor.cc
index 49e7eb9..ce2376f 100644 (file)
 #include <boost/bind.hpp>
 #include <boost/format.hpp>
 #include <boost/preprocessor/stringize.hpp>
-#include "../../Utils/senfassert.hh"
-#include "../../Utils/Range.hh"
-#include "../../Utils/String.hh"
-#include "../../Utils/range.hh"
+#include <senf/Utils/senfassert.hh>
+#include <senf/Utils/Range.hh>
 #include "Server.hh"
 
 //#include "Executor.mpp"
@@ -172,7 +170,15 @@ prefix_ void senf::console::Executor::execute(std::ostream & output,
 prefix_ senf::console::GenericNode &
 senf::console::Executor::getNode(ParseCommandInfo const & command)
 {
-    return traverseNode(command.commandPath());
+    try {
+        return traverseNode(command.commandPath());
+    }
+    catch (InvalidPathException & ex) {
+        throw SyntaxErrorException("invalid path") << " '" << ex.path << "'";
+    }
+    catch (InvalidDirectoryException & ex) {
+        throw SyntaxErrorException("invalid directory") << " '" << ex.path << "'";
+    }
 }
 
 prefix_ void senf::console::Executor::exec(std::ostream & output,