diff options
Diffstat (limited to 'src/Client/CommandParser.cpp')
-rw-r--r-- | src/Client/CommandParser.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp index b9368b5..ab1165b 100644 --- a/src/Client/CommandParser.cpp +++ b/src/Client/CommandParser.cpp @@ -21,6 +21,7 @@ #include "Requests/CoreStatusRequest.h" #include "Requests/DaemonListRequest.h" #include "Requests/DaemonStatusRequest.h" +#include <Common/Exception.h> #include <Common/Requests/DisconnectRequest.h> #include <Net/Packets/HostStatusPacket.h> #include <Net/Packets/NameListPacket.h> @@ -150,7 +151,7 @@ void CommandParser::statusCommand(const std::vector<std::string> &args) { if(args.size() == 1) Requests::CoreStatusRequest::send(connection, sigc::mem_fun(this, &CommandParser::coreStatusRequestFinished)); else if(args.size() == 2) - Requests::DaemonStatusRequest::send(connection, sigc::mem_fun(this, &CommandParser::daemonStatusRequestFinished), args[1]); + Requests::DaemonStatusRequest::send(connection, sigc::mem_fun(this, &CommandParser::daemonStatusRequestFinished), sigc::mem_fun(this, &CommandParser::errorCallback), args[1]); else { std::cerr << args[0] << ": Too many arguments." << std::endl; printUsage("status"); @@ -201,6 +202,13 @@ void CommandParser::daemonStatusRequestFinished(const Net::Packets::HostStatusPa requestFinished(); } +void CommandParser::errorCallback(const Common::Exception &exception) { + std::cerr << "An error occurred during your request." << std::endl; + std::cerr << "Error code: " << exception.getErrorCode() << std::endl << std::endl; + + requestFinished(); +} + bool CommandParser::split(const std::string &str, std::vector<std::string> &ret) { std::string temp; bool quoteSingle = false, quoteDouble = false, escape = false; |