Date: Tuesday, December 5, 2006 @ 02:31:13
  Author: marc
    Path: /cvsroot/carob/carob/src

Modified: CarobException.cpp (1.22 -> 1.23)

Log much more information before rethrowing UnexpectedException. Also chain 
when possible. Fixes CAROB-112.


--------------------+
 CarobException.cpp |   32 ++++++++++++++++++++++++++++----
 1 files changed, 28 insertions(+), 4 deletions(-)


Index: carob/src/CarobException.cpp
diff -u carob/src/CarobException.cpp:1.22 carob/src/CarobException.cpp:1.23
--- carob/src/CarobException.cpp:1.22   Tue Dec  5 01:49:19 2006
+++ carob/src/CarobException.cpp        Tue Dec  5 02:31:13 2006
@@ -100,12 +100,36 @@
 }
 void UnexpectedException::convertUnexpected()
 {
-  if (isErrorEnabled())
+  try
   {
-    logError(L"convertUnexpectedException",
-             L"Unexpected exception caught... Throwing Carob 
UnexpectedException");
+    if (isErrorEnabled())
+      logError(L"convertUnexpectedException",
+               L"Unexpected exception caught...");
+    throw;
+  }
+  catch(CarobException& ce)
+  {
+    std::wostringstream woss;
+    woss << ce;
+    if (isErrorEnabled())
+        logError(L"convertUnexpectedException", woss.str());
+    throw UnexpectedException(L"Unexpected CarobException", DEFAULTSQLSTATE, 
&ce);
+  }
+  catch(std::exception& stde)
+  {
+    if (isFatalEnabled())
+        logFatal(L"convertUnexpectedException",
+                 L"std::exception caught");
+    throw UnexpectedException(L"Unexpected std::exception "
+                              + CarobNS::StaticCodecs::fromASCII(stde.what()));
+  }
+  catch(...)
+  {
+    if (isFatalEnabled())
+        logFatal(L"convertUnexpectedException",
+                 L"non-CarobException caught");
+    throw UnexpectedException(L"Unknown exception type");
   }
-  throw UnexpectedException(L"Error not intercepted"); 
 }
 
 StackTraceElement::StackTraceElement(const DriverSocket& ds)

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to