diff options
Diffstat (limited to 'src/Common/RequestHandlers')
-rw-r--r-- | src/Common/RequestHandlers/FSInfoRequestHandler.cpp | 11 | ||||
-rw-r--r-- | src/Common/RequestHandlers/StatusRequestHandler.cpp | 11 |
2 files changed, 15 insertions, 7 deletions
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); |