From 0473fa912e2d2531529fec14a201efa3b20e2ef3 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sun, 2 Jan 2011 01:17:21 +0100 Subject: Print command name on unknown command. --- commands.cpp | 2 +- commands.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/commands.cpp b/commands.cpp index f37f78c..03af48c 100644 --- a/commands.cpp +++ b/commands.cpp @@ -75,7 +75,7 @@ std::vector commands::execute(const std::vector& 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); diff --git a/commands.h b/commands.h index bc4092f..42a9452 100644 --- a/commands.h +++ b/commands.h @@ -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(); -- cgit v1.2.3