From 0480576d43fb7ddcc16de9dab0619a1424f129fd Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 22 May 2009 14:21:06 +0200 Subject: SystemBackend ?berarbeitet --- .../RequestHandlers/CommandRequestHandler.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/Daemon') diff --git a/src/Daemon/RequestHandlers/CommandRequestHandler.cpp b/src/Daemon/RequestHandlers/CommandRequestHandler.cpp index 952837c..f8b7c31 100644 --- a/src/Daemon/RequestHandlers/CommandRequestHandler.cpp +++ b/src/Daemon/RequestHandlers/CommandRequestHandler.cpp @@ -45,21 +45,22 @@ void CommandRequestHandler::handlePacket(const Common::XmlPacket &packet) { std::string command = packet["command"]; - bool ok; - - if(command == "reboot") - ok = Common::SystemManager::get()->shutdown(); - else - ok = Common::SystemManager::get()->reboot(); - Common::XmlPacket ret; - if(ok) { + try { + if(command == "reboot") + Common::SystemManager::get()->shutdown(); + else + Common::SystemManager::get()->reboot(); + ret.setType("OK"); } - else { + catch(Net::Exception e) { ret.setType("Error"); - ret.add("ErrorCode", Net::Exception::NOT_IMPLEMENTED); + ret.add("ErrorCode", e.getErrorCode()); + ret.add("SubCode", e.getSubCode()); + ret.add("SubSubCode", e.getSubSubCode()); + ret.add("Where", e.getWhere()); } sendPacket(ret); -- cgit v1.2.3