summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2014-03-21 16:25:11 (GMT)
committerChristian Mollekopf <chrigi_1@fastmail.fm>2014-03-21 16:25:11 (GMT)
commita8968196c72913fd38e875667f7a5ce68e31a0d8 (patch)
tree911443bf72ab8b83e9eee4fce57f7315459073de
parent85da145b3bdd0be29df23dff1c41ba9b2289bcf5 (diff)
downloadlibkolabxml-a8968196c72913fd38e875667f7a5ce68e31a0d8.tar.gz
Follow up the parsing error message with message that it occurred during writing.
-rw-r--r--src/kolabformat.cpp27
-rw-r--r--src/utils.h8
2 files changed, 31 insertions, 4 deletions
diff --git a/src/kolabformat.cpp b/src/kolabformat.cpp
index abd8f54..4ab8ed1 100644
--- a/src/kolabformat.cpp
+++ b/src/kolabformat.cpp
@@ -89,6 +89,9 @@ std::string writeEvent(const Kolab::Event &event, const std::string& productId)
const std::string result = XCAL::serializeIncidence< XCAL::IncidenceTrait<Kolab::Event> >(event, productId);
//Validate
XCAL::deserializeIncidence< XCAL::IncidenceTrait<Kolab::Event> >(result, false);
+ if (errorOccurred()) {
+ LOG("Error occurred while writing.")
+ }
return result;
}
@@ -109,6 +112,9 @@ std::string writeTodo(const Kolab::Todo &event, const std::string& productId)
const std::string result = XCAL::serializeIncidence< XCAL::IncidenceTrait<Kolab::Todo> >(event, productId);
//Validate
XCAL::deserializeIncidence< XCAL::IncidenceTrait<Kolab::Todo> >(result, false);
+ if (errorOccurred()) {
+ LOG("Error occurred while writing.")
+ }
return result;
}
@@ -129,6 +135,9 @@ std::string writeJournal(const Kolab::Journal &j, const std::string& productId)
const std::string result = XCAL::serializeIncidence< XCAL::IncidenceTrait<Kolab::Journal> >(j, productId);
//Validate
XCAL::deserializeIncidence< XCAL::IncidenceTrait<Kolab::Journal> >(result, false);
+ if (errorOccurred()) {
+ LOG("Error occurred while writing.")
+ }
return result;
}
@@ -148,6 +157,9 @@ std::string writeFreebusy(const Freebusy &f, const std::string& productId)
validate(f);
const std::string result = XCAL::serializeFreebusy<XCAL::IncidenceTrait<Kolab::Freebusy> >(f, productId);
XCAL::deserializeIncidence<XCAL::IncidenceTrait<Kolab::Freebusy> >(result, false);
+ if (errorOccurred()) {
+ LOG("Error occurred while writing.")
+ }
return result;
}
@@ -168,6 +180,9 @@ std::string writeContact(const Contact &contact, const std::string& productId)
const std::string result = XCARD::serializeCard(contact, productId);
//Validate
XCARD::deserializeCard<Kolab::Contact>(result, false);
+ if (errorOccurred()) {
+ LOG("Error occurred while writing.")
+ }
return result;
}
@@ -188,6 +203,9 @@ std::string writeDistlist(const DistList &list, const std::string& productId)
const std::string result = XCARD::serializeCard(list, productId);
//Validate
XCARD::deserializeCard<Kolab::DistList>(result, false);
+ if (errorOccurred()) {
+ LOG("Error occurred while writing.")
+ }
return result;
}
@@ -208,6 +226,9 @@ std::string writeNote(const Note &note, const std::string& productId)
const std::string result = Kolab::KolabObjects::serializeObject<Kolab::Note>(note, productId);
//Validate
Kolab::KolabObjects::deserializeObject<Kolab::Note>(result, false);
+ if (errorOccurred()) {
+ LOG("Error occurred while writing.")
+ }
return result;
}
@@ -228,6 +249,9 @@ std::string writeFile(const File &file, const std::string& productId)
const std::string result = Kolab::KolabObjects::serializeObject<Kolab::File>(file, productId);
//Validate
Kolab::KolabObjects::deserializeObject<Kolab::File>(result, false);
+ if (errorOccurred()) {
+ LOG("Error occurred while writing.")
+ }
return result;
}
@@ -248,6 +272,9 @@ std::string writeConfiguration(const Configuration &config, const std::string& p
const std::string result = Kolab::KolabObjects::serializeObject<Kolab::Configuration>(config, productId);
//Validate
Kolab::KolabObjects::deserializeObject<Kolab::Configuration>(result, false);
+ if (errorOccurred()) {
+ LOG("Error occurred while writing.")
+ }
return result;
}
diff --git a/src/utils.h b/src/utils.h
index 2c7e579..2688af4 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -33,10 +33,10 @@ std::string getUID(const std::string & = std::string());
void logMessage(const std::string &,const std::string &, int, ErrorSeverity s);
-#define LOG(message) logMessage(message,__FILE__, __LINE__, NoError);
-#define WARNING(message) logMessage(message,__FILE__, __LINE__, Warning);
-#define ERROR(message) logMessage(message,__FILE__, __LINE__, Error);
-#define CRITICAL(message) logMessage(message,__FILE__, __LINE__, Critical);
+#define LOG(message) Utils::logMessage(message,__FILE__, __LINE__, NoError);
+#define WARNING(message) Utils::logMessage(message,__FILE__, __LINE__, Warning);
+#define ERROR(message) Utils::logMessage(message,__FILE__, __LINE__, Error);
+#define CRITICAL(message) Utils::logMessage(message,__FILE__, __LINE__, Critical);
void logMessage(const std::string &, ErrorSeverity s = Warning);