From 0480576d43fb7ddcc16de9dab0619a1424f129fd Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 22 May 2009 14:21:06 +0200 Subject: SystemBackend ?berarbeitet --- src/Common/RequestHandlers/FSInfoRequestHandler.cpp | 11 ++++++++--- src/Common/RequestHandlers/StatusRequestHandler.cpp | 11 +++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'src/Common/RequestHandlers') diff --git a/src/Common/RequestHandlers/FSInfoRequestHandler.cpp b/src/Common/RequestHandlers/FSInfoRequestHandler.cpp index 663e512..94756b5 100644 --- a/src/Common/RequestHandlers/FSInfoRequestHandler.cpp +++ b/src/Common/RequestHandlers/FSInfoRequestHandler.cpp @@ -47,7 +47,9 @@ void FSInfoRequestHandler::handlePacket(const XmlPacket &packet) { XmlPacket ret; - if(SystemManager::get()->getFSInfo(&fsInfo)) { + try { + SystemManager::get()->getFSInfo(&fsInfo); + ret.setType("OK"); ret.addList("filesystems"); @@ -62,9 +64,12 @@ void FSInfoRequestHandler::handlePacket(const XmlPacket &packet) { entry.add("availableSize", fs->available); } } - 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); diff --git a/src/Common/RequestHandlers/StatusRequestHandler.cpp b/src/Common/RequestHandlers/StatusRequestHandler.cpp index 94ec5b2..c564680 100644 --- a/src/Common/RequestHandlers/StatusRequestHandler.cpp +++ b/src/Common/RequestHandlers/StatusRequestHandler.cpp @@ -50,12 +50,15 @@ void StatusRequestHandler::handlePacket(const XmlPacket &packet) { float loadAvg1, loadAvg5, loadAvg15; + XmlPacket ret; - SystemManager::get()->getUptimeInfo(&uptime, &idleTime); - SystemManager::get()->getMemoryInfo(&totalMem, &freeMem, &totalSwap, &freeSwap); - SystemManager::get()->getLoadInfo(¤tLoad, &nProcesses, &loadAvg1, &loadAvg5, &loadAvg15); + try { + SystemManager::get()->getUptimeInfo(&uptime, &idleTime); + SystemManager::get()->getMemoryInfo(&totalMem, &freeMem, &totalSwap, &freeSwap); + SystemManager::get()->getLoadInfo(¤tLoad, &nProcesses, &loadAvg1, &loadAvg5, &loadAvg15); + } + catch(Net::Exception e) {} - XmlPacket ret; ret.setType("OK"); ret.add("uptime", uptime); -- cgit v1.2.3