diff options
author | Kyungwook Tak <k.tak@samsung.com> | 2016-07-04 18:18:59 +0900 |
---|---|---|
committer | Kyungwook Tak <k.tak@samsung.com> | 2016-07-04 18:27:53 +0900 |
commit | d82e4542803159badd94982198f397b28ae417e4 (patch) | |
tree | edff5e4f231b7bddd098012d6bbb2f45bcb2b431 | |
parent | e9c41ca7377a172c93da68144a3136ac4d80281c (diff) | |
download | csr-framework-d82e4542803159badd94982198f397b28ae417e4.tar.gz csr-framework-d82e4542803159badd94982198f397b28ae417e4.tar.bz2 csr-framework-d82e4542803159badd94982198f397b28ae417e4.zip |
Handle cancel event not to be printed as error
Change-Id: Iabc4fd9abf7ceb52ce04f00d6688599e29c92d1c
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
-rw-r--r-- | src/framework/client/async-logic.cpp | 11 | ||||
-rw-r--r-- | src/framework/service/exception.cpp | 8 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/framework/client/async-logic.cpp b/src/framework/client/async-logic.cpp index 454c184..5ed5192 100644 --- a/src/framework/client/async-logic.cpp +++ b/src/framework/client/async-logic.cpp @@ -58,11 +58,9 @@ void AsyncLogic::scanHelper(const CommandId &id, const StrSet &s) if (ret != ASYNC_EVENT_START) ThrowExc(ret, "Error on async scan. ret: " << ret); - bool isDone = false; - DEBUG("loop for waiting server event start!!"); - while (!isDone) { + while (true) { auto event = this->m_handle->revent<int>(); DEBUG("event received: " << event); @@ -105,8 +103,11 @@ void AsyncLogic::scanHelper(const CommandId &id, const StrSet &s) case ASYNC_EVENT_COMPLETE: { DEBUG("Async operation completed"); - isDone = true; - break; + return; + } + + case ASYNC_EVENT_CANCEL: { + ThrowExcInfo(ASYNC_EVENT_CANCEL, "Async operation cancelled!"); } default: diff --git a/src/framework/service/exception.cpp b/src/framework/service/exception.cpp index 7e5bf95..f395e10 100644 --- a/src/framework/service/exception.cpp +++ b/src/framework/service/exception.cpp @@ -26,6 +26,8 @@ #include "common/audit/logger.h" #include "common/binary-queue.h" +#include "common/async-protocol.h" + #include <csr-error.h> namespace Csr { @@ -35,7 +37,11 @@ RawBuffer exceptionGuard(const std::function<RawBuffer()> &func) try { return func(); } catch (const Exception &e) { - ERROR("Exception caught. code: " << e.error() << " message: " << e.what()); + if (e.error() == ASYNC_EVENT_CANCEL) + INFO("Async operation cancel exception: " << e.what()); + else + ERROR("Exception caught. code: " << e.error() << " message: " << e.what()); + return BinaryQueue::Serialize(e.error()).pop(); } catch (const std::invalid_argument &e) { ERROR("Invalid argument: " << e.what()); |