diff options
Diffstat (limited to 'src/Daemon')
-rw-r--r-- | src/Daemon/RequestHandlers/CommandRequestHandler.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
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); |