diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2011-01-02 01:17:21 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2011-01-02 01:17:21 +0100 |
commit | 0473fa912e2d2531529fec14a201efa3b20e2ef3 (patch) | |
tree | 5fd15e6f3074bf7637ea3f41f995858894dd64ec | |
parent | 3d5901b73cc4e46e57233ea3ccc9b27ffba4c7df (diff) |
Print command name on unknown command.
-rw-r--r-- | commands.cpp | 2 | ||||
-rw-r--r-- | commands.h | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/commands.cpp b/commands.cpp index f37f78c..03af48c 100644 --- a/commands.cpp +++ b/commands.cpp @@ -75,7 +75,7 @@ std::vector<std::string> commands::execute(const std::vector<std::string>& args) assert(args.size()); Handler h = commands::handlers[args[0]]; if(!h) { - throw CommandException("unknown command"); + throw CommandException(boost::str(boost::format("unknown command \"%s\"") % args[0])); } return h(args); @@ -15,6 +15,7 @@ namespace commands { class CommandException : public std::runtime_error { public: CommandException(const char *s) : std::runtime_error(s) {}; + CommandException(std::string s) : std::runtime_error(s.c_str()) {}; }; void init(); |