From d08a98b8304eb2c831907254095d6829fb98a95b Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 16 Sep 2008 04:54:36 +0200 Subject: Korrekte Reaktion auf Fehler in DaemonStatusRequest --- src/Client/CommandParser.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/Client/CommandParser.cpp') 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 #include #include #include @@ -150,7 +151,7 @@ void CommandParser::statusCommand(const std::vector &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 &ret) { std::string temp; bool quoteSingle = false, quoteDouble = false, escape = false; -- cgit v1.2.3