src/kolabconversions.h src/xcalconversions.h src/xcardconversions.h

Christian Mollekopf mollekopf at kolabsys.com
Wed Aug 8 22:38:00 CEST 2012


 src/kolabconversions.h |   20 ++++++++++++++------
 src/xcalconversions.h  |    7 ++++---
 src/xcardconversions.h |   10 +++++++---
 3 files changed, 25 insertions(+), 12 deletions(-)

New commits:
commit 9e2115cb9bce110fc0efe6bf14a807ff3969f77e
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Wed Aug 8 22:37:51 2012 +0200

    catch all exceptions and handle them more consistent

diff --git a/src/kolabconversions.h b/src/kolabconversions.h
index 2c4e0dc..1a9eb86 100644
--- a/src/kolabconversions.h
+++ b/src/kolabconversions.h
@@ -183,8 +183,11 @@ std::string serializeObject <Kolab::Configuration> (const Kolab::Configuration &
         KolabXSD::configuration(ostringstream, n, map);
         return ostringstream.str();
     } catch  (const xml_schema::exception& e) {
-        CRITICAL("Unknown Exception: failed to write Configuration");
+        std::cerr <<  e << std::endl;
+    } catch (...) {
+        CRITICAL("Unhandled exception");
     }
+    CRITICAL("Failed to write configuration!");
     return std::string();
 }
 
@@ -258,8 +261,11 @@ std::string serializeObject <Kolab::Note> (const Kolab::Note &note, const std::s
         KolabXSD::note(ostringstream, n, map);
         return ostringstream.str();
     } catch  (const xml_schema::exception& e) {
-        CRITICAL("Unknown Exception: failed to write Note");
+        std::cerr <<  e << std::endl;
+    } catch (...) {
+        CRITICAL("Unhandled exception");
     }
+    CRITICAL("Failed to write note!");
     return std::string();
 }
 
@@ -350,9 +356,10 @@ boost::shared_ptr<Kolab::Note> deserializeObject <Kolab::Note> (const std::strin
         return n;
     } catch  (const xml_schema::exception& e) {
         std::cerr <<  e << std::endl;
-        CRITICAL("Failed to read note!");
+    } catch (...) {
+        CRITICAL("Unhandled exception");
     }
-    
+    CRITICAL("Failed to read note!");
     return boost::shared_ptr<Kolab::Note>();
 }
 
@@ -415,9 +422,10 @@ boost::shared_ptr<Kolab::Configuration> deserializeObject <Kolab::Configuration>
         return n;
     } catch  (const xml_schema::exception& e) {
         std::cerr <<  e << std::endl;
-        CRITICAL("Failed to read configuration!");
+    } catch (...) {
+        CRITICAL("Unhandled exception");
     }
-
+    CRITICAL("Failed to read configuration!");
     return boost::shared_ptr<Kolab::Configuration>();
 }
     
diff --git a/src/xcalconversions.h b/src/xcalconversions.h
index c36cc42..0a419b9 100644
--- a/src/xcalconversions.h
+++ b/src/xcalconversions.h
@@ -1905,11 +1905,11 @@ typename T::IncidencePtr deserializeIncidence(const std::string& s, bool isUrl)
         }
         return *incidences.begin();
     } catch  (const xml_schema::exception& e) {
-        std::cout <<  e << std::endl;
-        CRITICAL("Failed to read incidence!");
+        std::cerr <<  e << std::endl;
     } catch (...) {
         CRITICAL("Unhandled exception");
     }
+    CRITICAL("Failed to read incidence!");
     return IncidencePtr();
 }
 
@@ -1953,10 +1953,11 @@ std::string serializeFreebusy(const Kolab::Freebusy &incidence, const std::strin
         icalendar_2_0::icalendar(ostringstream, icalendar, map);
         return ostringstream.str();
     } catch  (const xml_schema::exception& e) {
-        CRITICAL("failed to write Incidence");
+        std::cerr <<  e << std::endl;
     } catch (...) {
         CRITICAL("Unhandled exception");
     }
+    CRITICAL("failed to write Incidence");
     return std::string();
 }
 
diff --git a/src/xcardconversions.h b/src/xcardconversions.h
index dd23c3b..8e913d3 100644
--- a/src/xcardconversions.h
+++ b/src/xcardconversions.h
@@ -791,8 +791,11 @@ std::string serializeCard(const T &card, const std::string prod = std::string())
         vcard_4_0::vcards(ostringstream, vcards, map);
         return ostringstream.str();
     } catch  (const xml_schema::exception& e) {
-        CRITICAL("Unknown Exception: failed to write Contact");
+        std::cerr <<  e << std::endl;
+    } catch (...) {
+        CRITICAL("Unhandled exception");
     }
+    CRITICAL("Failed to write vcard!");
     return std::string();
 }
 
@@ -1141,9 +1144,10 @@ boost::shared_ptr<T> deserializeCard(const std::string& s, bool isUrl)
         return card;
     } catch  (const xml_schema::exception& e) {
         std::cerr <<  e << std::endl;
-        CRITICAL("Failed to read card!");
+    } catch (...) {
+        CRITICAL("Unhandled exception");
     }
-
+    CRITICAL("Failed to read vcard!");
     return boost::shared_ptr<T>();
 }
 





More information about the commits mailing list