summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2010-01-15 18:46:56 +0100
committerPatrick Ohly <patrick.ohly@intel.com>2010-01-19 18:24:36 +0100
commit209027a9d9c75e4ea73cdf3c5fd6f470ceae5980 (patch)
treee95c3a83243ebc24ac9b3344100407a05fd0c401
parent44c277f9bb216780dd2ce5129d5b0bf94b15f3e2 (diff)
local errors should be marked as local (MB #8757)slow-sync
Error codes >= sysync::LOCAL_STATUS_CODE stand for problems detected locally. This wasn't handled correctly by SyncEvolution: - by default, unknown local exceptions led to the non-local STATUS_FATAL = 500 - Synthesis error codes reported via BadSynthesisResult got lost in Exception::handle() because that exception class had no special catch clause
-rw-r--r--src/syncevo/util.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/syncevo/util.cpp b/src/syncevo/util.cpp
index 5f6c64a2..c59ae930 100644
--- a/src/syncevo/util.cpp
+++ b/src/syncevo/util.cpp
@@ -22,6 +22,7 @@
#include <syncevo/util.h>
#include <syncevo/SyncContext.h>
#include <syncevo/TransportAgent.h>
+#include <syncevo/SynthesisEngine.h>
#include <syncevo/Logging.h>
#include <synthesis/syerror.h>
@@ -314,7 +315,9 @@ std::string StringPrintfV(const char *format, va_list ap)
SyncMLStatus Exception::handle(SyncMLStatus *status, Logger *logger)
{
- SyncMLStatus new_status = STATUS_FATAL;
+ // any problem here is a fatal local problem, unless set otherwise
+ // by the specific exception
+ SyncMLStatus new_status = SyncMLStatus(STATUS_FATAL + sysync::LOCAL_STATUS_CODE);
try {
throw;
@@ -323,6 +326,10 @@ SyncMLStatus Exception::handle(SyncMLStatus *status, Logger *logger)
ex.m_file.c_str(), ex.m_line);
SE_LOG_ERROR(logger, NULL, "%s", ex.what());
new_status = SyncMLStatus(sysync::LOCERR_TRANSPFAIL);
+ } catch (const BadSynthesisResult &ex) {
+ new_status = SyncMLStatus(ex.result());
+ SE_LOG_DEBUG(logger, NULL, "error code from Synthesis engine %s",
+ Status2String(new_status).c_str());
} catch (const Exception &ex) {
SE_LOG_DEBUG(logger, NULL, "exception thrown at %s:%d",
ex.m_file.c_str(), ex.m_line);