[mapguide-commits] r6801 - in branches/2.4/MgDev: Common/MapGuideCommon/Resources Server/src/Common/Manager Server/src/Services/Feature

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Jun 22 07:46:06 PDT 2012


Author: jng
Date: 2012-06-22 07:46:06 -0700 (Fri, 22 Jun 2012)
New Revision: 6801

Modified:
   branches/2.4/MgDev/Common/MapGuideCommon/Resources/mapguide_en.res
   branches/2.4/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp
   branches/2.4/MgDev/Server/src/Services/Feature/ServerFeatureServiceExceptionDef.h
Log:
#2034: Include cause and root cause in any MgFdoException that gets thrown

Modified: branches/2.4/MgDev/Common/MapGuideCommon/Resources/mapguide_en.res
===================================================================
--- branches/2.4/MgDev/Common/MapGuideCommon/Resources/mapguide_en.res	2012-06-21 15:52:56 UTC (rev 6800)
+++ branches/2.4/MgDev/Common/MapGuideCommon/Resources/mapguide_en.res	2012-06-22 14:46:06 UTC (rev 6801)
@@ -230,11 +230,12 @@
 MgFailedToLoadFdoLibrary                              = Failed to load FDO library.
 MgFailedToRetrieveSystemExceptionMesage               = Failed to retrieve the system exception mesage. This message may not be unicode compliant.
 MgFailedToRetrieveThirdPartyExceptionMesage           = Failed to retrieve the third party exception mesage. This message may not be unicode compliant.
-MgFeatureSourceFormatInnerExceptionMessage            = Error occurred in Feature Source (%1): %2
+MgFeatureSourceFormatInnerExceptionMessage            = Error occurred in Feature Source (%1): %2 (Cause: %3, Root Cause: %4)
 MgFeatureReaderIdNotFound                             = The feature reader ID was not found.
 MgFilenamesIdentical                                  = The filenames cannot be the same.
 MgFormatAllExceptionDetail                            = - %1(%2)
 MgFormatAllExceptionStackTrace                        = - %1(%2) line %3 file %4
+MgFormatFdoExceptionMessage                           = %1 (Cause: %2, Root Cause: %3)
 MgFormatInnerExceptionMessage                         = %1
 MgGeometryEmpty                                       = The geometry cannot be empty.
 MgGeometryPropertyEmpty                               = The geometry property cannot be empty.

Modified: branches/2.4/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp
===================================================================
--- branches/2.4/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp	2012-06-21 15:52:56 UTC (rev 6800)
+++ branches/2.4/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp	2012-06-22 14:46:06 UTC (rev 6801)
@@ -361,6 +361,8 @@
             MgStringCollection args;
             args.Add(resourceIdentifier->ToString());
             args.Add(message);
+            args.Add(L"");
+            args.Add(L"");
 
             //Replace the exception to be thrown with our one
             mgException = new MgFdoException(L"MgFdoConnectionManager.Open", __LINE__, __WFILE__, NULL, L"MgFeatureSourceFormatInnerExceptionMessage", &args);

Modified: branches/2.4/MgDev/Server/src/Services/Feature/ServerFeatureServiceExceptionDef.h
===================================================================
--- branches/2.4/MgDev/Server/src/Services/Feature/ServerFeatureServiceExceptionDef.h	2012-06-21 15:52:56 UTC (rev 6800)
+++ branches/2.4/MgDev/Server/src/Services/Feature/ServerFeatureServiceExceptionDef.h	2012-06-22 14:46:06 UTC (rev 6801)
@@ -34,11 +34,22 @@
         MgStringCollection arguments;                                         \
         wchar_t* buf = (wchar_t*)e->GetExceptionMessage();                    \
         INT64 nativeErrorCode = e->GetNativeErrorCode();                      \
+        FdoPtr<FdoException> cause = e->GetCause();                           \
+        FdoPtr<FdoException> root = e->GetRootCause();                        \
                                                                               \
+        wchar_t* causeStr = NULL;                                             \
+        wchar_t* rootCauseStr = NULL;                                         \
+        if (NULL != cause.p)                                                  \
+            causeStr = (wchar_t*)cause->GetExceptionMessage();                \
+        if (NULL != root.p)                                                   \
+            rootCauseStr = (wchar_t*)root->GetExceptionMessage();             \
+                                                                              \
         if (NULL != buf)                                                      \
         {                                                                     \
-            messageId = L"MgFormatInnerExceptionMessage";                     \
+            messageId = L"MgFormatFdoExceptionMessage";                       \
             arguments.Add(buf);                                               \
+            arguments.Add((causeStr == NULL) ? L"" : causeStr);               \
+            arguments.Add((rootCauseStr == NULL) ? L"" : rootCauseStr);       \
         }                                                                     \
                                                                               \
         FDO_SAFE_RELEASE(e);                                                  \
@@ -54,12 +65,23 @@
         MgStringCollection arguments;                                         \
         wchar_t* buf = (wchar_t*)e->GetExceptionMessage();                    \
         INT64 nativeErrorCode = e->GetNativeErrorCode();                      \
+        FdoPtr<FdoException> cause = e->GetCause();                           \
+        FdoPtr<FdoException> root = e->GetRootCause();                        \
                                                                               \
+        wchar_t* causeStr = NULL;                                             \
+        wchar_t* rootCauseStr = NULL;                                         \
+        if (NULL != cause.p)                                                  \
+            causeStr = (wchar_t*)cause->GetExceptionMessage();                \
+        if (NULL != root.p)                                                   \
+            rootCauseStr = (wchar_t*)root->GetExceptionMessage();             \
+                                                                              \
         if (NULL != buf)                                                      \
         {                                                                     \
             messageId = L"MgFeatureSourceFormatInnerExceptionMessage";        \
             arguments.Add(fsId->ToString());                                  \
             arguments.Add(buf);                                               \
+            arguments.Add((causeStr == NULL) ? L"" : causeStr);               \
+            arguments.Add((rootCauseStr == NULL) ? L"" : rootCauseStr);       \
         }                                                                     \
                                                                               \
         FDO_SAFE_RELEASE(e);                                                  \
@@ -108,7 +130,16 @@
         MgStringCollection arguments;                                         \
         wchar_t* buf = (wchar_t*)e->GetExceptionMessage();                    \
         INT64 nativeErrorCode = e->GetNativeErrorCode();                      \
+        FdoPtr<FdoException> cause = e->GetCause();                           \
+        FdoPtr<FdoException> root = e->GetRootCause();                        \
                                                                               \
+        wchar_t* causeStr = NULL;                                             \
+        wchar_t* rootCauseStr = NULL;                                         \
+        if (NULL != cause.p)                                                  \
+            causeStr = (wchar_t*)cause->GetExceptionMessage();                \
+        if (NULL != root.p)                                                   \
+            rootCauseStr = (wchar_t*)root->GetExceptionMessage();             \
+                                                                              \
         if (NULL != buf)                                                      \
         {                                                                     \
             if((NULL != wcsstr(buf, L"Lost connection to MySQL server during query")) || \
@@ -125,6 +156,8 @@
             messageId = L"MgFeatureSourceFormatInnerExceptionMessage";        \
             arguments.Add(resource->ToString());                              \
             arguments.Add(buf);                                               \
+            arguments.Add((causeStr == NULL) ? L"" : causeStr);               \
+            arguments.Add((rootCauseStr == NULL) ? L"" : rootCauseStr);       \
         }                                                                     \
                                                                               \
         FDO_SAFE_RELEASE(e);                                                  \



More information about the mapguide-commits mailing list