summaryrefslogtreecommitdiffstats
path: root/src/Client/CommandParser.cpp
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2008-09-16 04:54:36 +0200
committerMatthias Schiffer <matthias@gamezock.de>2008-09-16 04:54:36 +0200
commitd08a98b8304eb2c831907254095d6829fb98a95b (patch)
tree5ae7b3dfa427b3680ded829a8d5c12e8ed16ae3a /src/Client/CommandParser.cpp
parenta37ee55e14db26ca273ddeca5b0ab0fb8c8de77c (diff)
downloadmad-d08a98b8304eb2c831907254095d6829fb98a95b.tar
mad-d08a98b8304eb2c831907254095d6829fb98a95b.zip
Korrekte Reaktion auf Fehler in DaemonStatusRequest
Diffstat (limited to 'src/Client/CommandParser.cpp')
-rw-r--r--src/Client/CommandParser.cpp10
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;