[mapguide-commits] r9744 - in sandbox/jng/flatten_exceptions/Common: CoordinateSystem Foundation/Exception Foundation/System Geometry Geometry/Buffer Geometry/CoordinateSystem Geometry/Exception Geometry/Parse Geometry/Spatial

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Oct 21 03:50:31 PDT 2020


Author: jng
Date: 2020-10-21 03:50:30 -0700 (Wed, 21 Oct 2020)
New Revision: 9744

Removed:
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemComputationFailedException.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemComputationFailedException.h
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemConversionFailedException.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemConversionFailedException.h
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemInitializationFailedException.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemInitializationFailedException.h
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemLoadFailedException.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemLoadFailedException.h
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemMeasureFailedException.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemMeasureFailedException.h
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemTransformFailedException.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemTransformFailedException.h
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/GeometryException.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/GeometryException.h
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemException.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemException.h
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemTypeException.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemTypeException.h
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemUnitsException.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemUnitsException.h
Modified:
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSys.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysCatalog.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysCategory.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysCategoryDictionary.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDatum.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDatumDictionary.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDictionary.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDictionaryBase.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDictionaryUtility.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEllipsoid.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEllipsoidDictionary.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnum.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumCategory.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumCoordinateSystemInCategory.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumDatum.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumEllipsoid.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumInteger32.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysFormatConverter.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticAnalyticalTransformDefParams.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticInterpolationTransformDefParams.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticMultipleRegressionTransformDefParams.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticPath.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticPathDictionary.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticPathElement.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticStandaloneTransformDefParams.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticTransformDef.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticTransformDefDictionary.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticTransformGridFile.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticTransformation.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGrids.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysMacro.h
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysMeasure.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysMgrs.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysProjectionInformation.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysTransform.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysUnitInformation.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysUtil.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/MentorDictionary.cpp
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/MentorDictionary.h
   sandbox/jng/flatten_exceptions/Common/CoordinateSystem/MentorUtil.cpp
   sandbox/jng/flatten_exceptions/Common/Foundation/Exception/ExceptionCodes.cpp
   sandbox/jng/flatten_exceptions/Common/Foundation/Exception/ExceptionCodes.h
   sandbox/jng/flatten_exceptions/Common/Foundation/Exception/ExceptionDefs.h
   sandbox/jng/flatten_exceptions/Common/Foundation/System/FoundationClassId.h
   sandbox/jng/flatten_exceptions/Common/Geometry/AgfStream.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/ArcSegment.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Buffer/MgBuffer.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Buffer/oobject.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/CoordinateSystem/CoordinateSystemFactory.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/CurvePolygon.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/CurveRing.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/CurveString.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Envelope.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/GeometricEntity.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Geometry.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Geometry.vcxproj
   sandbox/jng/flatten_exceptions/Common/Geometry/Geometry.vcxproj.filters
   sandbox/jng/flatten_exceptions/Common/Geometry/GeometryBuild.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/GeometryClassFactory.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/GeometryClassId.h
   sandbox/jng/flatten_exceptions/Common/Geometry/GeometryCommon.h
   sandbox/jng/flatten_exceptions/Common/Geometry/GeometrySimplifier.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/LineString.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/LinearRing.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/LinearSegment.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Parse/Array.h
   sandbox/jng/flatten_exceptions/Common/Geometry/Parse/ArrayHelper.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Parse/LexAwkt.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Parse/ParseAwkt.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Polygon.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Spatial/MathUtility.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Spatial/SpatialUtility.cpp
   sandbox/jng/flatten_exceptions/Common/Geometry/Spatial/SpatialUtilityCircularArc.cpp
Log:
Remove all exceptions in Geometry/CoordinateSystem and modify all throws to throw MgException, passing an exception code instead.

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSys.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSys.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSys.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -119,7 +119,7 @@
         assert(bResult);
         if (!bResult)
         {
-            throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.InitFromCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.InitFromCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         return;
     }
@@ -153,7 +153,7 @@
                 Ptr<MgDisposable> disposableCsObject = datumMapIterator->second;
                 MgCoordinateSystemDatum* datumInfo = dynamic_cast<MgCoordinateSystemDatum*>(disposableCsObject.p);
                 if (NULL == datumInfo)
-                    throw new MgInvalidArgumentException(L"MgCoordinateSystem.InitFromCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
+                    throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.InitFromCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
                 
                 pDatum = SAFE_ADDREF(datumInfo);
             }
@@ -164,7 +164,7 @@
             Ptr<MgCoordinateSystemDatumDictionary> pDtDict = m_pCatalog->GetDatumDictionary();
             if (!pDtDict)
             {
-                throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.InitFromCatalog", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDatumDictionaryException", NULL);
+                throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.InitFromCatalog", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDatumDictionaryException", NULL);
             }
 
             pDatum = pDtDict->Get(sDtName);
@@ -171,7 +171,7 @@
             assert(pDatum);
             if (!pDatum)
             {
-                throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.InitFromCatalog", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDatumInDictionaryException", NULL);
+                throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.InitFromCatalog", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDatumInDictionaryException", NULL);
             }
         }
 
@@ -195,7 +195,7 @@
                 Ptr<MgDisposable> disposableCsObject = ellipsoidMapIterator->second;
                 MgCoordinateSystemEllipsoid* ellipsoidInfo = dynamic_cast<MgCoordinateSystemEllipsoid*>(disposableCsObject.p);
                 if (NULL == ellipsoidInfo)
-                    throw new MgInvalidArgumentException(L"MgCoordinateSystem.InitFromCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
+                    throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.InitFromCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
                 
                 pEllipsoid = SAFE_ADDREF(ellipsoidInfo);
             }
@@ -207,7 +207,7 @@
             Ptr<MgCoordinateSystemEllipsoidDictionary> pElDict = m_pCatalog->GetEllipsoidDictionary();
             if (!pElDict)
             {
-                throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.InitFromCatalog", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoEllipsoidDictionaryException", NULL);
+                throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.InitFromCatalog", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoEllipsoidDictionaryException", NULL);
             }
 
             pEllipsoid = pElDict->Get(sElName);
@@ -214,7 +214,7 @@
             assert(pEllipsoid);
             if (!pEllipsoid)
             {
-                throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.InitFromCatalog", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoEllipsoidInDictionaryException", NULL);
+                throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.InitFromCatalog", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoEllipsoidInDictionaryException", NULL);
             }
         }
 
@@ -283,7 +283,7 @@
         pCoordinate = new MgCoordinateXYM(x, y, lonLat->GetM());
         if (!pCoordinate)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
     else if(lonLat->GetDimension() == MgCoordinateDimension::XYZ)
@@ -298,13 +298,13 @@
         pCoordinate = new MgCoordinateXYZM(x, y, z, lonLat->GetM());
         if (!pCoordinate)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
     else
     {
         // What dimension is this?
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertFromLonLat")
 
@@ -329,7 +329,7 @@
         pCoordinate = new MgCoordinateXYM(dLongitude, dLatitude, coordinate->GetM());
         if (!pCoordinate)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystem.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
     else if(coordinate->GetDimension() == MgCoordinateDimension::XYZ)
@@ -344,13 +344,13 @@
         pCoordinate = new MgCoordinateXYZM(dLongitude, dLatitude, dZDest, coordinate->GetM());
         if (!pCoordinate)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystem.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
     else
     {
         // What dimension is this?
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertToLonLat")
 
@@ -493,7 +493,7 @@
     // and there must be a Great Circle path between the points.
     if(GetType() == MgCoordinateSystemType::Arbitrary)
     {
-        throw new MgInvalidCoordinateSystemTypeException(L"MgCoordinateSystem.MeasureGreatCircleDistance", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMustNotBeArbitrary", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidCoordinateSystemTypeException, L"MgCoordinateSystem.MeasureGreatCircleDistance", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMustNotBeArbitrary", NULL);
     }
 
     Ptr<MgCoordinate> pLonLat1=ConvertToLonLat(x1, y1);
@@ -731,12 +731,12 @@
     pErrs = new int[nNumErrs];
     if (NULL == pErrs)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetErrors", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.GetErrors", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     pErrsInt32 = new INT32[nNumErrs];
     if (NULL == pErrsInt32)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetErrors", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.GetErrors", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Get the errors
@@ -750,7 +750,7 @@
 
     if (NULL == pNewEnum.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetErrors", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.GetErrors", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy in the results.  Mentor wants a list of ints, MgCoordinateSystemEnumInteger32
@@ -790,12 +790,12 @@
     MG_TRY()
     if (!m_pCatalog)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.ToString", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.ToString", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     Ptr<MgCoordinateSystemFormatConverter> pConverter=m_pCatalog->GetFormatConverter();
     if (!pConverter)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.ToString", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.ToString", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sWkt=pConverter->DefinitionToWkt(this, MgCoordinateSystemWktFlavor::Ogc);
     MG_CATCH_AND_THROW(L"MgCoordinateSystem.ToString")
@@ -812,7 +812,7 @@
     wchar_t* pUnit = Convert_UTF8_To_Wide(m_csprm.csdef.unit);
     if (NULL == pUnit)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetUnits", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.GetUnits", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     STRING sUnit(pUnit);
     delete[] pUnit;
@@ -838,7 +838,7 @@
     //Can't change read-only items
     if (Protected())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetUnitCode", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetUnitCode", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
 
     //Make sure the projection's been properly set
@@ -846,7 +846,7 @@
     if (MgCoordinateSystemProjectionCode::Unknown == prj)
     {
         //Projection hasn't been properly set, so we can't set the unit type.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetUnitCode", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetUnitCode", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     //Make sure it's a unit type we know about
@@ -855,7 +855,7 @@
     if (!GetUnitInfo(unit, &unitType, &dScale))
     {
         //Unknown unit type.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.SetUnitCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.SetUnitCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     assert(dScale > 0.0);
     assert(MgCoordinateSystemUnitType::Unknown != unitType);
@@ -866,7 +866,7 @@
     if (prjUnitType != unitType)
     {
         //Wrong unit type for this projection.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetUnitCode", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetUnitCode", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     //Okay, we're all set.  Copy in the values...
@@ -978,7 +978,7 @@
     wchar_t* pName = Convert_UTF8_To_Wide(m_csprm.csdef.key_nm);
     if (NULL == pName)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetCsCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.GetCsCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sName=pName;
     delete[] pName;
@@ -999,13 +999,13 @@
     if (Protected())
     {
         //Can't modify a read-only object.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetCsCode", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetCsCode", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
 
     if (sCode.empty())
     {
         //null pointer is obviously not legal...
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.SetCsCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.SetCsCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Convert to a C++ string, for Mentor's sake
@@ -1012,7 +1012,7 @@
     char *pStr = Convert_Wide_To_UTF8(sCode.c_str()); //need to delete[] pStr
     if (NULL == pStr)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.SetCsCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.SetCsCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Try to make a legal name.  CS_nampp() legalizes the
@@ -1024,7 +1024,7 @@
     {
         //illegal string
         delete [] pStr;
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.SetCsCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.SetCsCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy into the definition
@@ -1058,7 +1058,7 @@
     wchar_t* pProjection = Convert_UTF8_To_Wide(m_csprm.csdef.prj_knm);
     if (NULL == pProjection)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetProjection", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.GetProjection", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sProjection=pProjection;
     delete[] pProjection;
@@ -1091,13 +1091,13 @@
     if (Protected())
     {
         //Can't change read-only items
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetProjectionCode", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetProjectionCode", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
 
     if (MgCoordinateSystemProjectionCode::Unknown==prjType)
     {
         //cs_UNKWN_PROJ
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.SetProjectionCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.SetProjectionCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Set the projection string
@@ -1106,7 +1106,7 @@
     if (!kpProj)
     {
         //cs_UNKWN_PROJ
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.SetProjectionCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.SetProjectionCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //if same as the existing projection, do nothing
@@ -1124,7 +1124,7 @@
     if (!pp)
     {
         //cs_UNKWN_PROJ
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.SetProjectionCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.SetProjectionCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     m_csprm.prj_code = pp->code;
     m_csprm.prj_flags = pp->flags;
@@ -1204,7 +1204,7 @@
     wchar_t* pDatum = Convert_UTF8_To_Wide(m_csprm.csdef.dat_knm);
     if (NULL == pDatum)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetDatum", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.GetDatum", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sDatum=pDatum;
     delete[] pDatum;
@@ -1266,7 +1266,7 @@
     wchar_t* pEllipsoid = Convert_UTF8_To_Wide(m_csprm.csdef.elp_knm);
     if (NULL == pEllipsoid)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.GetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sEllipsoid=pEllipsoid;
     delete[] pEllipsoid;
@@ -1379,19 +1379,19 @@
     Ptr<MgCoordinateSystemCategoryDictionary> pCtDict=m_pCatalog->GetCategoryDictionary();
     if (!pCtDict)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.GetCategories", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoCategoryDictionaryException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.GetCategories", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoCategoryDictionaryException", NULL);
     }
     //get the category dictionary pointer
     Ptr<MgCoordinateSystemEnum> pEnumCategories=pCtDict->GetEnum();
     if (!pEnumCategories)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.GetCategories", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.GetCategories", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
    pCategoryNames = new MgStringCollection();
    if (!pCategoryNames)
    {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetCategories", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.GetCategories", __LINE__, __WFILE__, NULL, L"", NULL);
    }
 
     //list all the categories one by one
@@ -1530,7 +1530,7 @@
         Ptr<MgCoordinateSystemDatumDictionary> pDtDict=pCatalog->GetDatumDictionary();
         if (!pDtDict)
         {
-            throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.IsUsable", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDatumDictionaryException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.IsUsable", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDatumDictionaryException", NULL);
         }
 
         //Build a wchar_t* from the datum name
@@ -1537,7 +1537,7 @@
         wchar_t* pStrDt = Convert_UTF8_To_Wide(m_csprm.csdef.dat_knm);
         if (NULL == pStrDt)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystem.IsUsable", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.IsUsable", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         STRING strDt(pStrDt);
         delete[] pStrDt;
@@ -1554,7 +1554,7 @@
         Ptr<MgCoordinateSystemEllipsoidDictionary> pElDict=pCatalog->GetEllipsoidDictionary();
         if (!pElDict)
         {
-            throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.IsUsable", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoEllipsoidDictionaryException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.IsUsable", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoEllipsoidDictionaryException", NULL);
         }
 
         //Build a wchar_t* from the ellipsoid name
@@ -1561,7 +1561,7 @@
         wchar_t* pStrEl = Convert_UTF8_To_Wide(m_csprm.csdef.elp_knm);
         if (NULL == pStrEl)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystem.IsUsable", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.IsUsable", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         STRING strEl(pStrEl);
         delete[] pStrEl;
@@ -1600,7 +1600,7 @@
     bool bResult = BuildCsDefFromInterface(pCsDef, def);
     if (!bResult)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.IsSameAs", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.IsSameAs", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //And compare with this one!
@@ -1705,7 +1705,7 @@
     //Make an object to be the copy
     if (NULL == pNew.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy data members into the new object.  NOTE:  if new
@@ -1723,7 +1723,7 @@
         Ptr<MgCoordinateSystemDatum> pDtClone=m_pDatum->CreateClone();
         if (NULL == pDtClone.p)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystem.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         pNew->m_pDatum = pDtClone;
     }
@@ -1733,7 +1733,7 @@
         Ptr<MgCoordinateSystemEllipsoid> pElClone=m_pEllipsoid->CreateClone();
         if (NULL == pElClone.p)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystem.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         pNew->m_pEllipsoid = pElClone;
     }
@@ -1757,7 +1757,7 @@
     wchar_t* pDesc = Convert_UTF8_To_Wide(m_csprm.csdef.desc_nm);
     if (NULL == pDesc)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetDescription", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.GetDescription", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sDesc=pDesc;
     delete[] pDesc;
@@ -1797,7 +1797,7 @@
     wchar_t* pGroup = Convert_UTF8_To_Wide(m_csprm.csdef.group);
     if (NULL == pGroup)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetGroup", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.GetGroup", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sGroup=pGroup;
     delete[] pGroup;
@@ -1835,7 +1835,7 @@
     wchar_t* pSource = Convert_UTF8_To_Wide(m_csprm.csdef.source);
     if (NULL == pSource)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetSource", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.GetSource", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sSource=pSource;
     delete[] pSource;
@@ -1917,7 +1917,7 @@
     wchar_t* pLoc = Convert_UTF8_To_Wide(m_csprm.csdef.locatn);
     if (NULL == pLoc)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetLocation", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.GetLocation", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sLoc=pLoc;
     delete[] pLoc;
@@ -1957,7 +1957,7 @@
     wchar_t* pCntrySt = Convert_UTF8_To_Wide(m_csprm.csdef.cntry_st);
     if (NULL == pCntrySt)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetCountryOrState", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.GetCountryOrState", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sCntrySt=pCntrySt;
     delete[] pCntrySt;
@@ -2010,7 +2010,7 @@
     if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
     {
         //Projection type hasn't been properly initialized.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.GetProjectionParamCount", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.GetProjectionParamCount", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     // Now for each possible parameter.
@@ -2043,7 +2043,7 @@
     //Make sure the parameter is in the valid range
     if ((nIndex < 1) || (nIndex > knCsNumParams))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.GetProjectionParameter", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.GetProjectionParameter", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Make sure that this parameter is used by this projection
@@ -2051,7 +2051,7 @@
     if (MgCoordinateSystemProjectionCode::Unknown == prj)
     {
         //Projection type hasn't been properly initialized.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.GetProjectionParameter", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.GetProjectionParameter", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
     short prjCode = prj;
     //The following function call returns 1 if this
@@ -2065,7 +2065,7 @@
     if (1 != nResult)
     {
         //The parameter isn't used.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.GetProjectionParameter", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.GetProjectionParameter", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     //The parameter is used.  Return it.
@@ -2093,13 +2093,13 @@
     //Can't change read-only items
     if (Protected())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetProjectionParameter", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetProjectionParameter", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
 
     //Make sure the parameter is in the valid range
     if ((nIndex < 1) || (nIndex > knCsNumParams))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.SetProjectionParameter", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.SetProjectionParameter", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Make sure this parameter is used by this projection
@@ -2107,7 +2107,7 @@
     if (MgCoordinateSystemProjectionCode::Unknown == prj)
     {
         //Projection type hasn't been properly initialized.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetProjectionParameter", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetProjectionParameter", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
     struct cs_Prjprm_ info;
     short prjCode = prj;
@@ -2123,7 +2123,7 @@
     {
         //The specified parameter isn't used by this
         //projection.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetProjectionParameter", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetProjectionParameter", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     //Okay, at this point we know our projection type
@@ -2134,7 +2134,7 @@
     if ((dValue < info.min_val) || (dValue > info.max_val))
     {
         //They've given us an illegal value!
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.SetProjectionParameter", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.SetProjectionParameter", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Okay, the value they've given us is legitimate, too.
@@ -2166,7 +2166,7 @@
     //Make sure we're not read-only
     if (Protected())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetOriginLongitude", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetOriginLongitude", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
 
     m_csprm.csdef.org_lng = dOrgLng;
@@ -2193,7 +2193,7 @@
     //Make sure we're not read-only
     if (Protected())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetOriginLatitude", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetOriginLatitude", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
 
     m_csprm.csdef.org_lat = dOrgLat;
@@ -2223,7 +2223,7 @@
     if (Protected())
     {
         //Can't modify a read-only object.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetOffsets", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetOffsets", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
 
     m_csprm.csdef.x_off = dXOffset;
@@ -2258,7 +2258,7 @@
     if (Protected())
     {
         //Can't modify a read-only object.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetScaleReduction", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetScaleReduction", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
     INT32 prj = ProjectionFromString(m_csprm.csdef.prj_knm);
     if (ProjectionUsesSclRed(prj))
@@ -2287,7 +2287,7 @@
     if (Protected())
     {
         //Can't modify a read-only object.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetMapScale", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetMapScale", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
 
     m_csprm.csdef.map_scl = dMapScale;
@@ -2319,7 +2319,7 @@
     if (Protected())
     {
         //Can't modify a read-only object.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetZeroes", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetZeroes", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
 
     m_csprm.csdef.zero[0] = (dXZero < 0.0)? 0.0 : dXZero;
@@ -2373,7 +2373,7 @@
     if (Protected())
     {
         //Can't modify a read-only object.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetLonLatBounds", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetLonLatBounds", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
 
     OrderMinMax(dLonMin, dLonMax);
@@ -2403,7 +2403,7 @@
     if (Protected())
     {
         //Can't modify a read-only object.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.CancelLonLatBounds", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.CancelLonLatBounds", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
 
     //it will only be set on CsMap's transformation struct, i.e.
@@ -2428,7 +2428,7 @@
     //Make sure we're not read-only
     if (Protected())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetXYBounds", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetXYBounds", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
 
     OrderMinMax(dXMin, dXMax);
@@ -2452,7 +2452,7 @@
     //Make sure we're not read-only
     if (Protected())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.CancelXYBounds", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.CancelXYBounds", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
 
     m_csprm.min_xy[0] = 0.0;
@@ -2481,12 +2481,12 @@
     //Make sure we're not read-only
     if (Protected())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetQuadrant", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetQuadrant", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
 
     if ((sQuad < -4) || (sQuad > 4) || (0 == sQuad))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.SetQuadrant", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.SetQuadrant", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     m_csprm.csdef.quad = sQuad;
@@ -2524,21 +2524,21 @@
     if (Protected())
     {
         //Can't modify a read-only object.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetDatum", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetDatum", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
     //no DT or EL if NERTH projection is used
     if (ProjectionIsNerthType (GetProjectionCode()))
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetDatum", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDatumIfArbitraryException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetDatum", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDatumIfArbitraryException", NULL);
     }
     if (!IsLegalMentorName(sDatum.c_str()))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.SetDatum", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.SetDatum", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     char *pStr = Convert_Wide_To_UTF8(sDatum.c_str()); //need to delete[] pStr
     if (NULL == pStr)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.SetDatum", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.SetDatum", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     memset(m_csprm.csdef.dat_knm, 0, sizeof(m_csprm.csdef.key_nm));
@@ -2553,21 +2553,21 @@
     if (Protected())
     {
         //Can't modify a read-only object.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetEllipsoid", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetEllipsoid", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
     //no DT or EL if NERTH projection is used
     if (ProjectionIsNerthType (GetProjectionCode()))
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetEllipsoid", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDatumIfArbitraryException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetEllipsoid", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDatumIfArbitraryException", NULL);
     }
     if (!IsLegalMentorName(sEllipsoid.c_str()))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.SetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.SetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     char *pStr = Convert_Wide_To_UTF8(sEllipsoid.c_str()); //need to delete[] pStr
     if (NULL == pStr)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.SetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.SetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     memset(m_csprm.csdef.dat_knm, 0, sizeof(m_csprm.csdef.key_nm));
@@ -2601,7 +2601,7 @@
     if (Protected())
     {
         //Can't modify a read-only object.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
     */
 
@@ -2608,7 +2608,7 @@
     //no DT or EL if NERTH projection is used
     if (ProjectionIsNerthType (GetProjectionCode()))
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDatumIfArbitraryException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDatumIfArbitraryException", NULL);
     }
 
     //Get information out of the datum def
@@ -2616,7 +2616,7 @@
     bool bResult = BuildDtDefFromInterface(pDatum, dtdef);
     if (!bResult)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //If the coordinate system is not geodetic we need to switch it
@@ -2644,7 +2644,7 @@
         || (0 != CS_nampp(dtdef.key_nm))
         || (0 != CS_stricmp(m_csprm.csdef.dat_knm, dtdef.key_nm)))
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     //Get information out of the ellipsoid def
@@ -2652,13 +2652,13 @@
     assert(pEllipsoid);
     if (!pEllipsoid)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     cs_Eldef_ eldef;
     bResult = BuildElDefFromInterface(pEllipsoid, eldef);
     if (!bResult)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Okay, at this point we have a cs_Csdef_, cs_Dtdef_, and cs_Eldef_
@@ -2669,7 +2669,7 @@
     CriticalClass.Leave();
     if (NULL == pCsprm)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemInternalException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemInternalException", NULL);
     }
 
     //Everything worked okay!  Copy the data into our member variables.
@@ -2678,7 +2678,7 @@
     Ptr<MgCoordinateSystemDatum> pDatumClone = pDatum->CreateClone();
     if (NULL == pDatumClone.p)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     m_pDatum = pDatumClone;
 
@@ -2688,7 +2688,7 @@
     //Make sure the coordinate system is valid
     if (!IsValid())
     {
-         throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+         throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetDatumDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     MG_CATCH(L"MgCoordinateSystem.SetDatumDefinition")
@@ -2750,7 +2750,7 @@
     if (Protected())
     {
         //Can't modify a read-only object.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
     */
 
@@ -2757,7 +2757,7 @@
     //no DT or EL if NERTH projection is used
     if (ProjectionIsNerthType (GetProjectionCode()))
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoEllipsoidIfArbitraryException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoEllipsoidIfArbitraryException", NULL);
     }
 
     //Get information out of the Ellipsoid def
@@ -2765,7 +2765,7 @@
     bool bResult = BuildElDefFromInterface(pEllipsoid, eldef);
     if (!bResult)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //If the coordinate system is geodetic we need to switch it
@@ -2793,7 +2793,7 @@
         || (0 != CS_nampp(eldef.key_nm))
         || (0 != CS_stricmp(m_csprm.csdef.elp_knm, eldef.key_nm)))
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     //Okay, at this point we have a valid cs_Csdef_ and cs_Eldef_.
@@ -2804,7 +2804,7 @@
     CriticalClass.Leave();
     if (NULL == pDatum)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemInternalException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemInternalException", NULL);
     }
 
     CriticalClass.Enter();
@@ -2812,7 +2812,7 @@
     CriticalClass.Leave();
     if (NULL == pCsprm)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemInternalException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemInternalException", NULL);
     }
 
     //We're all set.  Initialize our data members.
@@ -2821,7 +2821,7 @@
     Ptr<MgCoordinateSystemEllipsoid> pEllipsoidClone = pEllipsoid->CreateClone();
     if (NULL == pEllipsoidClone.p)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     m_pEllipsoid = pEllipsoidClone;
 
@@ -2830,7 +2830,7 @@
     //Make sure the coordinate system is valid
     if (!IsValid())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     MG_CATCH(L"MgCoordinateSystem.SetEllipsoidDefinition")
@@ -2898,7 +2898,7 @@
     else
     {
         // What dimension is this?
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertFromLonLat")
 }
@@ -2927,7 +2927,7 @@
     else
     {
         // What dimension is this?
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertFromLonLat")
 }
@@ -2948,7 +2948,7 @@
     pCoordinate=new MgCoordinateXY(dLongitude, dLatitude);
     if (!pCoordinate)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertToLonLat")
     return pCoordinate.Detach();
@@ -2964,7 +2964,7 @@
     pCoordinate=new MgCoordinateXYZ(dLongitude, dLatitude, dZDest);
     if (!pCoordinate)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertToLonLat")
     return pCoordinate.Detach();
@@ -2987,7 +2987,7 @@
     pCoordinate=new MgCoordinateXY(dX, dY);
     if (!pCoordinate)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertFromLonLat")
     return pCoordinate.Detach();
@@ -3003,7 +3003,7 @@
     pCoordinate=new MgCoordinateXYZ(dX, dY, dZDest);
     if (!pCoordinate)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertFromLonLat")
     return pCoordinate.Detach();
@@ -3060,13 +3060,13 @@
     if (Protected())
     {
         //Can't modify a read-only object.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.SetString", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.SetString", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
 
     if (!IsLegalString(sSrc.c_str(), nMaxSize))
     {
         //Can't set string, caller gave us an illegal value
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.SetString", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.SetString", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Convert to a C++ string, for Mentor's sake
@@ -3073,7 +3073,7 @@
     char *pStr = Convert_Wide_To_UTF8(sSrc.c_str()); //need to delete[] pStr
     if (NULL == pStr)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.SetString", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.SetString", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy it in
@@ -3190,7 +3190,7 @@
     //Make sure we've been initialized
     if (!IsInitialized())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.IsValidCoord", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.IsValidCoord", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     //Find out whether we're in range
@@ -3232,7 +3232,7 @@
     //Make sure we're initialized
     if (!IsInitialized())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.ConvertPoint", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.ConvertPoint", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     //Do the conversion.
@@ -3252,7 +3252,7 @@
     {
         //The conversion failed, because we're outside the
         //mathematical domain of the coordinate system.
-        throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystem.ConvertPoint", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionExtentException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystem.ConvertPoint", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionExtentException", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystem.ConvertPoint")
@@ -3273,7 +3273,7 @@
     //Make sure we're initialized
     if (!IsInitialized())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.GetDouble", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.GetDouble", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     //Check the range.  We need to do this even if range checking
@@ -3289,7 +3289,7 @@
     if (nResult & cs_CNVRT_DOMN)
     {
         //Outside the mathematical domain!
-        throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystem.GetDouble", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionExtentException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystem.GetDouble", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionExtentException", NULL);
     }
 
     //Do the conversion.
@@ -3304,7 +3304,7 @@
     {
         //WARNING
         //should really be a warning but throwing exception
-        throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystem.GetDouble", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionWarningException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystem.GetDouble", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionWarningException", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetDouble")
@@ -3326,7 +3326,7 @@
     pNew=new CCoordinateSystemMeasure(this);
     if (!pNew)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystem.GetMeasure", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystem.GetMeasure", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystem.GetMeasure")
     return pNew;
@@ -3379,7 +3379,7 @@
     assert(NULL != pStream);
     if (!pStream)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     UINT8 nVersion=pStreamOut[0];
@@ -3415,7 +3415,7 @@
         {
             m_bEncrypted = bPrevEncrypted;
             m_csprm.csdef = prevDef;
-            throw new MgInvalidArgumentException(L"MgCoordinateSystem.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
 
@@ -3432,7 +3432,7 @@
     assert(NULL != pStream);
     if (!pStream)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystem.SerializeTo", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystem.SerializeTo", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //save the version

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysCatalog.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysCatalog.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysCatalog.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -81,7 +81,7 @@
 
     if (!m_pCsDict || !m_pDtDict || !m_pElDict || !m_pCtDict || !m_pGpDict || !m_pGxDict)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemCatalog.MgCoordinateSystemCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemCatalog.MgCoordinateSystemCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Set up Mentor global variables.  See CSDATA.C for explanation.
@@ -249,7 +249,7 @@
     if (sDir.empty())
     {
         ACE_DEBUG((LM_DEBUG, "(%t) DefaultDir for the Coordinate System library has been set but is empty.\n"));
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemCatalog.GetDefaultDictionaryDir", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemCatalog.GetDefaultDictionaryDir", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     if (!MgFileUtil::IsDirectory(sDir.c_str()))
@@ -260,7 +260,7 @@
 
     if (!bResult)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemCatalog.GetDefaultDictionaryDir", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemCatalog.GetDefaultDictionaryDir", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //And return success.
@@ -353,7 +353,7 @@
     //CS-Map return -1 if for cs_altdr() the Coordsys.CSD file couldn't be found; 0 otherwise
 
     if (csmapResult)
-        throw new MgFileIoException(L"MgCoordinateSystemCatalog.SetDictionaryDir", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"MgCoordinateSystemCatalog.SetDictionaryDir", __LINE__, __WFILE__, NULL, L"", NULL);
 
     return szPath;
 }
@@ -363,7 +363,7 @@
     MG_TRY()
 
     if (sDirPath.empty())
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemCatalog.SetDictionaryDir", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemCatalog.SetDictionaryDir", __LINE__, __WFILE__, NULL, L"", NULL);
 
     m_libraryStatus = lsInitializationFailed;
     m_sDir = this->SetDictionaryDir(sDirPath, false, CS_altdr);
@@ -475,7 +475,7 @@
         || !m_pGxDict || m_pGxDict->GetFileName().empty())
     {
         //Directory hasn't been specified yet.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemCatalog.AreDictionaryFilesWritable", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemCatalog.AreDictionaryFilesWritable", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     //the [m_sUserDir] will only contain something, if [SetUserDictionaryDir] had been called
@@ -655,7 +655,7 @@
     //need to get at data files to do certain datum shifts.
     if (m_sDir.empty())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemCatalog.GetGeodeticTransformations", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemCatalog.GetGeodeticTransformations", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     Ptr<CCoordinateSystemGeodeticTransformation> pNew = new CCoordinateSystemGeodeticTransformation(this, pSource, pTarget);
@@ -662,7 +662,7 @@
 
     if (NULL == pNew.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemCatalog.GetGeodeticTransformations", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemCatalog.GetGeodeticTransformations", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     pColl = new MgDisposableCollection;
@@ -669,7 +669,7 @@
 
     if (NULL == pColl.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemCatalog.GetGeodeticTransformations", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemCatalog.GetGeodeticTransformations", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     pColl->Add(pNew);
@@ -688,7 +688,7 @@
     pNew=new CCoordinateSystemMathComparator;
     if (NULL == pNew)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemCatalog.GetMathComparator", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemCatalog.GetMathComparator", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemCatalog.GetMathComparator")
     //And we're done!  Return success.
@@ -703,7 +703,7 @@
     pNew=new CCoordinateSystemFormatConverter(this);
     if (NULL == pNew)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemCatalog.GetFormatConverter", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemCatalog.GetFormatConverter", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemCatalog.GetFormatConverter")
 
@@ -719,7 +719,7 @@
     pNew=new CCoordinateSystemProjectionInformation();
     if (NULL == pNew)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemCatalog.GetProjectionInformation", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemCatalog.GetProjectionInformation", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemCatalog.GetProjectionInformation")
 
@@ -735,7 +735,7 @@
     pNew=new CCoordinateSystemUnitInformation();
     if (NULL == pNew)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemCatalog.GetUnitInformation", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemCatalog.GetUnitInformation", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemCatalog.GetUnitInformation")
 
@@ -751,7 +751,7 @@
     pNew=new CCoordinateSystemDictionaryUtility(this);
     if (NULL == pNew)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemCatalog.GetDictionaryUtility", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemCatalog.GetDictionaryUtility", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemCatalog.GetDictionaryUtility")
 

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysCategory.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysCategory.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysCategory.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -58,7 +58,7 @@
     }
 
     if (NULL == pCategoryCopy)
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemCategory.CtorInit", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemCategory.CtorInit", __LINE__, __WFILE__, NULL, L"", NULL);
 
     pToInitialize->m_pCatalog = SAFE_ADDREF(pCatalog);
     pToInitialize->mp_ctDef = pCategoryCopy;
@@ -113,15 +113,15 @@
     CHECKARGUMENTNULL(pDef, L"MgCoordinateSystemCategory.CopyFrom");
 
     if (!const_cast<CCoordinateSystemCategory*>(pDef)->IsValid())
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemCategory.CopyFrom", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemCategory.CopyFrom", __LINE__, __WFILE__, NULL, L"", NULL);
 
     CCoordinateSystemCategory const* pOtherCategory = dynamic_cast<CCoordinateSystemCategory const*>(pDef);
     if (NULL == pOtherCategory)
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemCategory.CopyFrom", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemCategory.CopyFrom", __LINE__, __WFILE__, NULL, L"", NULL);
 
     cs_Ctdef_* pCategoryCopy = CScpyCategory(pOtherCategory->mp_ctDef);
     if (NULL == pCategoryCopy)
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemCategory.CopyFrom", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemCategory.CopyFrom", __LINE__, __WFILE__, NULL, L"", NULL);
 
     MG_TRY()
 
@@ -163,7 +163,7 @@
 
         if (!IsLegalName(sName))
         {
-            throw new MgInvalidArgumentException(L"MgCoordinateSystemCategory.SetName", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemCategory.SetName", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         pszNewName = Convert_Wide_To_UTF8(sName.c_str());
@@ -264,13 +264,13 @@
     if (NULL == pCtDef->mp_ctDef)
     {
         _ASSERT(false);
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemCategory.IsSameAs", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemCategory.IsSameAs", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     if (NULL == this->mp_ctDef)
     {
         _ASSERT(false);
-        throw new MgInvalidOperationException(L"MgCoordinateSystemCategory.IsSameAs", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgCoordinateSystemCategory.IsSameAs", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     if (this->mp_ctDef->nameCnt != pCtDef->mp_ctDef->nameCnt)
@@ -395,12 +395,12 @@
     pName = Convert_Wide_To_UTF8(sName.c_str());    //need to delete [] pName
     if (NULL == pName)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemCategory.AddCoordinateSystem", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemCategory.AddCoordinateSystem", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     if (!IsLegalMentorName(pName))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemCategory.AddCoordinateSystem", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemCategory.AddCoordinateSystem", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //See if it's already present
@@ -408,13 +408,13 @@
     if (itList != allCsNames.end())
     {
         //duplicate!
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemCategory.AddCoordinateSystem", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemCategoryDuplicateException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemCategory.AddCoordinateSystem", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemCategoryDuplicateException", NULL);
     }
 
     if (CSaddItmNameEx(this->mp_ctDef, pName))
     {
         _ASSERT(false); //whatever the problem is here... the name we validated; OOM ? hopefully unlikely
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemCategory.AddCoordinateSystem", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemCategoryDuplicateException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemCategory.AddCoordinateSystem", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemCategoryDuplicateException", NULL);
     }
 
     //Try to insert it in our list
@@ -451,7 +451,7 @@
         _ASSERT(NULL != pName); //would throw an exception otherwise
 
         if (!IsLegalMentorName(pName))
-            throw new MgInvalidArgumentException(L"MgCoordinateSystemCategory.RemoveCoordinateSystem", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemCategory.RemoveCoordinateSystem", __LINE__, __WFILE__, NULL, L"", NULL);
 
         if (CSrmvItmNameEx(this->mp_ctDef, pName))
         {
@@ -463,7 +463,7 @@
                 allCsNames.clear();
             }
 
-            throw new MgInvalidArgumentException(L"MgCoordinateSystemCategory.RemoveCoordinateSystem", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemCategory.RemoveCoordinateSystem", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         //See if it's already present
@@ -530,7 +530,7 @@
     //create the new empty cs_Ctdef_ instance first
     struct cs_Ctdef_* pNewCategory = CSnewCategory(NULL);
     if (NULL == pNewCategory)
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemCategory.MgCoordinateSystemCategory", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemCategory.MgCoordinateSystemCategory", __LINE__, __WFILE__, NULL, L"", NULL);
 
     CSrlsCategory(this->mp_ctDef);
     this->mp_ctDef = pNewCategory;

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysCategoryDictionary.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysCategoryDictionary.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysCategoryDictionary.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -79,7 +79,7 @@
 
     if (NULL == pNewDef.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemCategoryDictionary.NewCategory", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemCategoryDictionary.NewCategory", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystemCategoryDictionary.NewCategory")
@@ -155,7 +155,7 @@
         if (categoryCount < 0)
         {
             _ASSERT(NULL == pAllCategories);
-            throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemCategoryDictionary.GenerateIndex", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemCategoryDictionary.GenerateIndex", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         for(int i = 0; i < categoryCount; ++i)
@@ -216,7 +216,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(sFileName);
-        throw new MgFileIoException(L"MgCoordinateSystemDictionary.SetFileName", __LINE__, __WFILE__, &arguments, L"MgInvalidArgumentException", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"MgCoordinateSystemDictionary.SetFileName", __LINE__, __WFILE__, &arguments, L"MgInvalidArgumentException", NULL);
     }
 
     if (!sFileName.empty())
@@ -288,7 +288,7 @@
     CCoordinateSystemCategory* pCategoryDef=dynamic_cast<CCoordinateSystemCategory*>(pDefinition);
     if (!pCategoryDef)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemCategoryDictionary.Add", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemCategoryDictionary.Add", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     cs_Ctdef_ const* pCsMapDef = pCategoryDef->GetCategoryDef();
@@ -298,7 +298,7 @@
     if (iter != Index().end())
     {
         //Yup.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemCategoryDictionary.Add", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDuplicateException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemCategoryDictionary.Add", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDuplicateException", NULL);
     }
 
     int updateResult = CS_ctupd(pCsMapDef);
@@ -305,7 +305,7 @@
     if (updateResult < 0)
     {
         //the category could not be added to the dictionary
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemCategoryDictionary.Add", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemCategoryDictionary.Add", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     _ASSERT(0 == updateResult); //we must have added it; +1 means "updated"
@@ -351,7 +351,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(sName);
-        throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemCategoryDictionary.Remove", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemCategoryDictionary.Remove", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
     }
 
     bInvalidIndexOnFailure = true;
@@ -361,7 +361,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(sName);
-        throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemCategoryDictionary.Remove", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemCategoryDictionary.Remove", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
     }
 
     int deletionResult = CS_ctdel(pCategory);
@@ -369,7 +369,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(sName);
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemCategoryDictionary.Remove", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemInternalException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemCategoryDictionary.Remove", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemInternalException", NULL);
     }
 
     long position = iter->second;
@@ -419,7 +419,7 @@
         CCoordinateSystemCategory* pCategoryDef=dynamic_cast<CCoordinateSystemCategory*>(pDefinition);
         if (!pCategoryDef)
         {
-            throw new MgInvalidArgumentException(L"MgCoordinateSystemCategoryDictionary.Modify", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemCategoryDictionary.Modify", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
         }
 
         //Look for it in our index
@@ -426,7 +426,7 @@
         STRING str = pCategoryDef->GetName();
         if (str.empty())
         {
-            throw new MgInvalidArgumentException(L"MgCoordinateSystemCategoryDictionary.Modify", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemCategoryDictionary.Modify", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         pName = Convert_Wide_To_UTF8(str.c_str());
 
@@ -437,7 +437,7 @@
         {
             MgStringCollection arguments;
             arguments.Add(str);
-            throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemCategoryDictionary.Modify", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemCategoryDictionary.Modify", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
         }
 
         invalidIndexOnFailure = true;
@@ -448,7 +448,7 @@
         {
             MgStringCollection arguments;
             arguments.Add(str);
-            throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemCategoryDictionary.Modify", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemInternalException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemCategoryDictionary.Modify", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemInternalException", NULL);
         }
 
         _ASSERT(1 == updateResult);
@@ -500,7 +500,7 @@
             //Nope.
             MgStringCollection arguments;
             arguments.Add(sName);
-            throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemCategoryDictionary.GetCategory", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemCategoryDictionary.GetCategory", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
         }
 
         invalidIndexOnFailure = true;
@@ -511,7 +511,7 @@
             //Nope.
             MgStringCollection arguments;
             arguments.Add(sName);
-            throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemCategoryDictionary.GetCategory", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemCategoryDictionary.GetCategory", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
         }
 
         //Make a new object with the [cs_Ctdef_] instance we got
@@ -610,7 +610,7 @@
             //nope, not there
             MgStringCollection arguments;
             arguments.Add(sOldName);
-            throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemCategoryDictionary.Rename", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemCategoryDictionary.Rename", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
         }
 
         invalidIndexOnFailure = true;
@@ -619,15 +619,15 @@
         {
             MgStringCollection arguments;
             arguments.Add(sOldName);
-            throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemCategoryDictionary.Rename", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemCategoryDictionary.Rename", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
         }
 
         pNewName = Convert_Wide_To_UTF8(sNewName.c_str());
         if (CSrplCatNameEx(pOldName, pNewName))
-            throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemCategoryDictionary.Rename", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotFoundException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemCategoryDictionary.Rename", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotFoundException", NULL);
 
         if (CSupdCategories(NULL))
-            throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemCategoryDictionary.Rename", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotFoundException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemCategoryDictionary.Rename", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotFoundException", NULL);
 
         long index = iter->second;
         Index().erase(iter);

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDatum.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDatum.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDatum.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -92,7 +92,7 @@
 
     if (NULL == pEl.p)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemDatum.GetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumInitializationFailedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemDatum.GetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumInitializationFailedException", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystemDatum.GetEllipsoidDefinition")
@@ -125,7 +125,7 @@
     //Make sure the specified datum is valid
     if (def.key_nm[0]=='\0')
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemDatum.InitFromCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDatum.InitFromCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //init the datum defintion part
@@ -152,7 +152,7 @@
     wchar_t* pwszElName=Convert_UTF8_To_Wide(def.ell_knm);
     if (!pwszElName)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.InitFromCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatum.InitFromCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     STRING sElName(::ToLower(pwszElName));
     delete[] pwszElName;
@@ -169,7 +169,7 @@
             Ptr<MgDisposable> disposableCsObject = ellipsoidsIterator->second;
             MgCoordinateSystemEllipsoid* ellipsoidInfo = dynamic_cast<MgCoordinateSystemEllipsoid*>(disposableCsObject.p);
             if (NULL == ellipsoidInfo)
-                throw new MgInvalidArgumentException(L"MgCoordinateSystemDatum.InitFromCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDatum.InitFromCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
             
             pEllipsoid = SAFE_ADDREF(ellipsoidInfo);
         }
@@ -182,7 +182,7 @@
         Ptr<MgCoordinateSystemEllipsoidDictionary> pElDict = m_pCatalog->GetEllipsoidDictionary();
         if (!pElDict)
         {
-            throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemDatum.InitFromCatalog", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumNoEllipsoidDictionaryException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemDatum.InitFromCatalog", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumNoEllipsoidDictionaryException", NULL);
         }
 
         //load the ellipsoid defintion from the dictionary
@@ -191,7 +191,7 @@
     }
 
     if (NULL == pEllipsoid)
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemDatum.InitFromCatalog", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumNoEllipsoidInDictionaryException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemDatum.InitFromCatalog", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumNoEllipsoidInDictionaryException", NULL);
 
     //Initialize from ellipsoid definitions we have
     SetEllipsoidDefinition(dynamic_cast<MgCoordinateSystemEllipsoid*>(pEllipsoid.p));
@@ -224,7 +224,7 @@
     wchar_t* pName = Convert_UTF8_To_Wide(m_DtDef.key_nm);
     if (NULL == pName)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.GetDtCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatum.GetDtCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sCode=pName;
     delete[] pName;
@@ -245,13 +245,13 @@
     if (Protected())
     {
         //Can't modify a read-only object.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemDatum.SetDtCode", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemDatum.SetDtCode", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumProtectedException", NULL);
     }
 
     if (sCode.empty())
     {
         //null pointer is obviously not legal...
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemDatum.SetDtCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDatum.SetDtCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Convert to a C++ string, for Mentor's sake
@@ -258,7 +258,7 @@
     char *pStr = Convert_Wide_To_UTF8(sCode.c_str()); //need to delete[] pStr
     if (NULL == pStr)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.SetDtCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatum.SetDtCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Try to make a legal name.  CS_nampp() legalizes the
@@ -270,7 +270,7 @@
     {
         //illegal string
         delete [] pStr;
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemDatum.SetDtCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDatum.SetDtCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy into the definitions, dtdef and cs_datum_ must be in synch
@@ -366,7 +366,7 @@
     Ptr<MgCoordinateSystemEllipsoidDictionary> pElDict=pCatalog->GetEllipsoidDictionary();
     if (!pElDict)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemDatum.IsUsable", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumNoEllipsoidDictionaryException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemDatum.IsUsable", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumNoEllipsoidDictionaryException", NULL);
     }
 
     //Build a wchar_t* from the ellipsoid name
@@ -373,7 +373,7 @@
     wchar_t* pStrEl = Convert_UTF8_To_Wide(m_datum.ell_knm);
     if (NULL == pStrEl)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.IsUsable", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatum.IsUsable", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     STRING sElName(pStrEl);
     delete[] pStrEl;
@@ -409,7 +409,7 @@
     cs_Dtdef_ def;
     if (!BuildDtDefFromInterface(pDtDef, def))
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemDatum.IsSameAs", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemDatum.IsSameAs", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //And compare with this one!
@@ -462,7 +462,7 @@
 
     if (NULL == pNew.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatum.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy data members into the new object.  NOTE:  if new
@@ -500,7 +500,7 @@
     wchar_t* pDesc = Convert_UTF8_To_Wide(m_datum.dt_name);
     if (NULL == pDesc)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.GetDescription", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatum.GetDescription", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sDesc=pDesc;
     delete[] pDesc;
@@ -540,7 +540,7 @@
     wchar_t *pGroup = Convert_UTF8_To_Wide(m_DtDef.group);
     if (NULL == pGroup)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.GetGroup", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatum.GetGroup", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sGroup=pGroup;
     delete[] pGroup;
@@ -576,7 +576,7 @@
     wchar_t *pSource = Convert_UTF8_To_Wide(m_DtDef.source);
     if (NULL == pSource)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.GetSource", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatum.GetSource", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sSource=pSource;
     delete[] pSource;
@@ -659,7 +659,7 @@
     wchar_t* pLoc = Convert_UTF8_To_Wide(m_DtDef.locatn);
     if (NULL == pLoc)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.GetLocation", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatum.GetLocation", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sLoc=pLoc;
     delete[] pLoc;
@@ -696,7 +696,7 @@
     wchar_t *pCountryOrState = Convert_UTF8_To_Wide(m_DtDef.cntry_st);
     if (NULL == pCountryOrState)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.GetCountryOrState", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatum.GetCountryOrState", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sCountryOrState=pCountryOrState;
     delete[] pCountryOrState;
@@ -734,7 +734,7 @@
     wchar_t* pEllipsoid = Convert_UTF8_To_Wide(m_DtDef.ell_knm);
     if (NULL == pEllipsoid)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.GetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatum.GetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sEllipsoid=pEllipsoid;
     delete[] pEllipsoid;
@@ -755,13 +755,13 @@
     if (Protected())
     {
         //can't change a read-only object
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemDatum.SetEllipsoid", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemDatum.SetEllipsoid", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumProtectedException", NULL);
     }
 
     //Make sure it's a legal datum name
     if (!IsLegalMentorName(sEllipsoid.c_str()))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemDatum.SetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDatum.SetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Convert wchar_t* to C++ string
@@ -768,7 +768,7 @@
     char *pStr = Convert_Wide_To_UTF8(sEllipsoid.c_str()); //need to delete [] pStr
     if (NULL == pStr)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.SetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatum.SetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     assert(strlen(pStr) < sizeof(m_DtDef.key_nm));
 
@@ -843,7 +843,7 @@
     //Make sure it's a legal datum name
     if (!IsLegalMentorName(sEllipsoid.c_str()))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemDatum.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDatum.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Convert wchar_t* to C++ string
@@ -850,7 +850,7 @@
     char *pStr = Convert_Wide_To_UTF8(sEllipsoid.c_str()); //need to delete [] pStr
     if (NULL == pStr)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatum.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     assert(strlen(pStr) < sizeof(m_DtDef.key_nm));
 
@@ -871,7 +871,7 @@
     bool bResult = BuildElDefFromInterface(pEllipsoidDef, eldef);
     if (!bResult)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemDatum.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemDatum.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Make sure the datum's specified ellipsoid matches the
@@ -884,7 +884,7 @@
         || (0 != CS_nampp(eldef.key_nm))
         || (0 != CS_stricmp(m_DtDef.ell_knm, eldef.key_nm)))
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemDatum.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemDatum.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumMismatchException", NULL);
     }
 
     //Build a cs_Datum_ from the datum and ellipsoid definitions
@@ -893,7 +893,7 @@
     CriticalClass.Leave();
     if (NULL == pDatum)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemDatum.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumInternalException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemDatum.SetEllipsoidDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumInternalException", NULL);
     }
 
     //Okay, everything succeeded.  Hang on to a copy of the
@@ -930,7 +930,7 @@
 
     if (NULL == pNew.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.GetGeodeticTransformations", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatum.GetGeodeticTransformations", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     pColl = new MgDisposableCollection;
@@ -937,7 +937,7 @@
 
     if (NULL == pColl.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.GetGeodeticTransformations", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatum.GetGeodeticTransformations", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     pColl->Add(pNew);
@@ -961,13 +961,13 @@
     if (Protected())
     {
         //Can't modify a read-only object.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemDatum.SetString", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemDatum.SetString", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumProtectedException", NULL);
     }
 
     if (!IsLegalString(sSrc.c_str(), nMaxSize))
     {
         //Can't set string, caller gave us an illegal value
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemDatum.SetString", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDatum.SetString", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Convert to a C++ string, for Mentor's sake
@@ -974,7 +974,7 @@
     char *pStr = Convert_Wide_To_UTF8(sSrc.c_str()); //need to delete[] pStr
     if (NULL == pStr)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatum.SetString", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatum.SetString", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy it in
@@ -1009,7 +1009,7 @@
     assert(NULL != pStream);
     if (!pStream)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemDatum.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDatum.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     UINT8 nVersion=pStreamOut[0];
@@ -1057,7 +1057,7 @@
         {
             m_bEncrypted = bPrevEncrypted;
             m_DtDef = prevDef;
-            throw new MgInvalidArgumentException(L"MgCoordinateSystemDatum.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDatum.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
 
@@ -1074,7 +1074,7 @@
     assert(NULL != pStream);
     if (!pStream)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemDatum.SerializeTo", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDatum.SerializeTo", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //save the version

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDatumDictionary.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDatumDictionary.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDatumDictionary.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -313,7 +313,7 @@
 
     if (NULL == pNewDef.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatumDictionary.NewDatum", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatumDictionary.NewDatum", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystemDatumDictionary.NewDatum")
@@ -345,7 +345,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(sFileName);
-        throw new MgFileIoException(L"MgCoordinateSystemDatumDictionary.SetFileName", __LINE__, __WFILE__, &arguments, L"MgInvalidArgumentException", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"MgCoordinateSystemDatumDictionary.SetFileName", __LINE__, __WFILE__, &arguments, L"MgInvalidArgumentException", NULL);
     }
 
     MentorDictionary::SetFileName(
@@ -414,7 +414,7 @@
     nSize=(ulFileBytes - sizeof(m_lMagic)) / nRecSize;
     if (0!=CS_fclose(pFile))
     {
-        throw new MgFileIoException(L"MgCoordinateSystemDatumDictionary.GetSize", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"MgCoordinateSystemDatumDictionary.GetSize", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemDatumDictionary.GetSize")
 
@@ -440,7 +440,7 @@
     MgCoordinateSystemDatum* pDatumDef=dynamic_cast<MgCoordinateSystemDatum*>(pDefinition);
     if (!pDatumDef)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemDatumDictionary.Add", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDatumDictionary.Add", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     MentorDictionary::UpdateDef<cs_Dtdef_, MgCoordinateSystemDatum>(
@@ -487,7 +487,7 @@
     MgCoordinateSystemDatum* pDatumDef=dynamic_cast<MgCoordinateSystemDatum*>(pDefinition);
     if (!pDatumDef)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemDatumDictionary.Modify", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDatumDictionary.Modify", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     MentorDictionary::UpdateDef<cs_Dtdef_, MgCoordinateSystemDatum>(
@@ -539,7 +539,7 @@
         //wasn't there!
         MgStringCollection whatArguments;
         whatArguments.Add(sName);
-        throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemDatumDictionary.GetDatum", __LINE__, __WFILE__, &whatArguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemDatumDictionary.GetDatum", __LINE__, __WFILE__, &whatArguments, L"", NULL);
     }
 
     //Okay, at this point we have a Mentor coordsys definition
@@ -596,7 +596,7 @@
     char *pName = Convert_Wide_To_UTF8(sName.c_str()); //need to delete [] pName
     if (NULL == pName)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatumDictionary.Has", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatumDictionary.Has", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     if (NULL != m_pmapSystemNameDescription)
@@ -684,7 +684,7 @@
 
             //close the file before calling into the [read all CS-Map defs] method
             if (0 != CS_fclose(pFile))
-                throw new MgFileIoException(L"MgCoordinateSystemDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
+                throw new MgException(MgExceptionCodes::MgFileIoException, L"MgCoordinateSystemDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
 
             pFile = NULL;
 
@@ -698,7 +698,7 @@
         }
         if (NULL == m_pmapSystemNameDescription)
         {
-            throw new MgInvalidArgumentException(L"MgCoordinateSystemDatumDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDatumDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
 
@@ -707,7 +707,7 @@
 
     if (NULL == pNew.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDatumDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDatumDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_CATCH(L"MgCoordinateSystemDatumDictionary.GetEnum")
@@ -716,7 +716,7 @@
     {
         const bool fileClosed = (0 == CS_fclose(pFile));
         if (!fileClosed && NULL == mgException) //throw this exception in case no other exception has already been caught
-            mgException = new MgFileIoException(L"MgCoordinateSystemDatumDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
+            mgException = new MgException(MgExceptionCodes::MgFileIoException, L"MgCoordinateSystemDatumDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
 
         pFile = NULL;
     }
@@ -743,7 +743,7 @@
 
     CCoordinateSystemDatumDictionary* datumDictionary = dynamic_cast<CCoordinateSystemDatumDictionary*>(targetDictionary);
     if (NULL == datumDictionary) //everything else is an implementation defect
-        throw new MgInvalidArgumentException(L"CCoordinateSystemDatumDictionary.ReadAllDatums", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"CCoordinateSystemDatumDictionary.ReadAllDatums", __LINE__, __WFILE__, NULL, L"", NULL);
 
     //place a lock here - we don't want any interference; what we need is the *current* status of all dictionary files
     SmartCriticalClass dictionaryLock;

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDictionary.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDictionary.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDictionary.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -168,7 +168,7 @@
         nNameSize = sizeof(v8.key_nm);
         return;
     default:
-        throw new MgCoordinateSystemInitializationFailedException(
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, 
             L"GetCoordinateSystemSizeInfo", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -332,7 +332,7 @@
 
     if (NULL == pNewDef.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDictionary.NewCoordinateSystem", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDictionary.NewCoordinateSystem", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystemDictionary.NewCoordinateSystem")
@@ -366,7 +366,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(sFileName);
-        throw new MgFileIoException(L"MgCoordinateSystemDictionary.SetFileName", __LINE__, __WFILE__, &arguments, L"MgInvalidArgumentException", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"MgCoordinateSystemDictionary.SetFileName", __LINE__, __WFILE__, &arguments, L"MgInvalidArgumentException", NULL);
     }
 
     MentorDictionary::SetFileName(
@@ -434,7 +434,7 @@
 
     if (0!=CS_fclose(pFile))
     {
-        throw new MgFileIoException(L"MgCoordinateSystemDictionary.GetSize", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"MgCoordinateSystemDictionary.GetSize", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystemDictionary.GetSize")
@@ -461,7 +461,7 @@
     MgCoordinateSystem* pCoordinateSystem=dynamic_cast<MgCoordinateSystem*>(pDefinition);
     if (!pCoordinateSystem)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemDictionary.Add", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDictionary.Add", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     MentorDictionary::UpdateDef<cs_Csdef_, MgCoordinateSystem>(
@@ -508,7 +508,7 @@
     MgCoordinateSystem* pCoordinateSystem=dynamic_cast<MgCoordinateSystem*>(pDefinition);
     if (!pCoordinateSystem)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemDictionary.Modify", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDictionary.Modify", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     MentorDictionary::UpdateDef<cs_Csdef_, MgCoordinateSystem>(
@@ -551,7 +551,7 @@
 
     if (NULL == pName)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDictionary.GetCoordinateSystem", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDictionary.GetCoordinateSystem", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Look in the dictionary
@@ -562,7 +562,7 @@
         //wasn't there!
         MgStringCollection whatArguments;
         whatArguments.Add(sName);
-        throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemDictionary.GetCoordinateSystem", __LINE__, __WFILE__, &whatArguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemDictionary.GetCoordinateSystem", __LINE__, __WFILE__, &whatArguments, L"", NULL);
     }
 
     //Okay, at this point we have a Mentor coordsys definition
@@ -627,7 +627,7 @@
     char *pName = Convert_Wide_To_UTF8(sName.c_str()); //need to delete [] pName
     if (NULL == pName)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDictionary.Has", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDictionary.Has", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     if (NULL != m_pmapSystemNameDescription)
@@ -662,7 +662,7 @@
 
     CCoordinateSystemDictionary* csDictionary = dynamic_cast<CCoordinateSystemDictionary*>(targetDictionary);
     if (NULL == csDictionary)
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemDictionary.ReadAllCoordinateSystems", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDictionary.ReadAllCoordinateSystems", __LINE__, __WFILE__, NULL, L"", NULL);
 
     //in order to create the MgCoordinateSystem objects, we have to have also the information on the datums and ellipsoids
     map<STRING, Ptr<MgDisposable> > ellipsoidMap;
@@ -756,7 +756,7 @@
             //Generate summary for version 7 or 8 coordsys file.
             //close the file before calling into the [read all CS-Map defs] method
             if (0 != CS_fclose(pFile))
-                throw new MgFileIoException(L"MgCoordinateSystemDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
+                throw new MgException(MgExceptionCodes::MgFileIoException, L"MgCoordinateSystemDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
 
             pFile = NULL;
 
@@ -770,7 +770,7 @@
         }
         if (NULL == m_pmapSystemNameDescription)
         {
-            throw new MgInvalidArgumentException(L"MgCoordinateSystemDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
 
@@ -779,12 +779,12 @@
 
     if (NULL == pNew.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     if (pFile && 0 != CS_fclose(pFile))
     {
-        throw new MgFileIoException(L"MgCoordinateSystemDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"MgCoordinateSystemDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
     }
     pFile = NULL;
 

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDictionaryBase.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDictionaryBase.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDictionaryBase.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -134,7 +134,7 @@
 
     if(NULL != pFile && (0 != CS_fclose(pFile)))
     {
-        throw new MgFileIoException(L"CCoordinateSystemDictionaryBase.GetSize", __LINE__, __WFILE__, NULL, NULL, NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"CCoordinateSystemDictionaryBase.GetSize", __LINE__, __WFILE__, NULL, NULL, NULL);
     }
 
     MG_THROW()
@@ -151,7 +151,7 @@
 
     T* pDictionaryDef = dynamic_cast<T*>(pDefinition);
     if (!pDictionaryDef)
-        throw new MgInvalidArgumentException(L"CCoordinateSystemDictionaryBase.Add", __LINE__, __WFILE__, NULL, L"CCoordinateSystemDictionaryBase", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"CCoordinateSystemDictionaryBase.Add", __LINE__, __WFILE__, NULL, L"CCoordinateSystemDictionaryBase", NULL);
 
     MG_TRY()
 
@@ -193,7 +193,7 @@
 
     T* pDictionaryDef = dynamic_cast<T*>(pDefinition);
     if (!pDictionaryDef)
-        throw new MgInvalidArgumentException(L"CCoordinateSystemDictionaryBase.Modify", __LINE__, __WFILE__, NULL, L"CCoordinateSystemDictionaryBase", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"CCoordinateSystemDictionaryBase.Modify", __LINE__, __WFILE__, NULL, L"CCoordinateSystemDictionaryBase", NULL);
 
     MG_TRY()
 
@@ -239,12 +239,12 @@
     {
         MgStringCollection whatArguments;
         whatArguments.Add(sName);
-        throw new MgCoordinateSystemLoadFailedException(L"CCoordinateSystemDictionaryBase.Get", __LINE__, __WFILE__, &whatArguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"CCoordinateSystemDictionaryBase.Get", __LINE__, __WFILE__, &whatArguments, L"", NULL);
     }
 
     pDefinition = this->NewItem(); //no AddRef; release if needed
     if (NULL == pDefinition.p) //ABA ???
-        throw new MgOutOfMemoryException(L"CCoordinateSystemDictionaryBase.Get", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"CCoordinateSystemDictionaryBase.Get", __LINE__, __WFILE__, NULL, L"", NULL);
 
     //we've created the Mg instance, we got the CS_Map definition; now let the Mg instance initialize itself from the
     //struct;
@@ -276,10 +276,17 @@
 
         return NULL != definition;
     }
-    catch(MgCoordinateSystemLoadFailedException* loadFailedException)
+    catch (MgException* ex)
     {
-        loadFailedException->Release();
-        return false;
+        if (ex->GetExceptionCode() == MgExceptionCodes::MgCoordinateSystemLoadFailedException)
+        {
+            ex->Release();
+            return false;
+        }
+        else
+        {
+            ex->Raise();
+        }
     }
 
     MG_CATCH_AND_THROW(L"CCoordinateSystemDictionaryBase.Has")
@@ -325,7 +332,7 @@
             definitionAccess->readAllDefinitions);
 
         if (NULL == allDictionaryEntries) //whatever happend here - the dictionay file seems to be invalid
-            throw new MgCoordinateSystemLoadFailedException(L"CCoordinateSystemDictionaryBase.GetEnumImp", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"CCoordinateSystemDictionaryBase.GetEnumImp", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     else
     {
@@ -343,7 +350,7 @@
         && NULL == mgException.p)
         //if there hasn't yet an exception occurred we now have one
         //if there was one already we (unfortunately) do now swallow the MgFileIoException
-        mgException = new MgFileIoException(L"CCoordinateSystemDictionaryBase.GetEnumImp", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
+        mgException = new MgException(MgExceptionCodes::MgFileIoException, L"CCoordinateSystemDictionaryBase.GetEnumImp", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
 
     MG_THROW()
 

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDictionaryUtility.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDictionaryUtility.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysDictionaryUtility.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -88,7 +88,7 @@
     char *pDict = Convert_Wide_To_Ascii(kpDict);    //need to delete [] pDict;
     if (NULL == pDict)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemDictionaryUtility.CreateDictionaryFile", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemDictionaryUtility.CreateDictionaryFile", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Make sure the file doesn't already exist
@@ -99,7 +99,7 @@
         CS_fclose(pFile);
         delete [] pDict;
         //It already exists, but it's not supposed to.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemDictionaryUtility.CreateDictionaryFile", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDuplicateException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemDictionaryUtility.CreateDictionaryFile", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDuplicateException", NULL);
     }
     if (pFile)
     {
@@ -113,7 +113,7 @@
     if (1!=nWrite || ferror(pFile))
     {
         CS_fclose(pFile);
-        throw new MgFileIoException(L"MgCoordinateSystemDictionaryUtility.CreateDictionaryFile", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"MgCoordinateSystemDictionaryUtility.CreateDictionaryFile", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Success!

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEllipsoid.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEllipsoid.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEllipsoid.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -63,13 +63,13 @@
     if (Protected())
     {
         //Can't modify a read-only object.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemEllipsoid.SetString", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemEllipsoidProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemEllipsoid.SetString", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemEllipsoidProtectedException", NULL);
     }
 
     if (!IsLegalString(sSrc.c_str(), nMaxSize))
     {
         //Can't set string, caller gave us an illegal value
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoid.SetString", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoid.SetString", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Convert to a C++ string, for Mentor's sake
@@ -76,7 +76,7 @@
     char *pStr = Convert_Wide_To_UTF8(sSrc.c_str()); //need to delete[] pStr
     if (NULL == pStr)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEllipsoid.SetString", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEllipsoid.SetString", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy it in
@@ -118,7 +118,7 @@
     wchar_t *pName = Convert_UTF8_To_Wide(m_def.key_nm);
     if (NULL == pName)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEllipsoid.GetElCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEllipsoid.GetElCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sName=pName;
     delete[] pName;
@@ -137,12 +137,12 @@
     if (Protected())
     {
         //Can't modify a read-only object.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemEllipsoid.SetElCode", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemEllipsoidProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemEllipsoid.SetElCode", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemEllipsoidProtectedException", NULL);
     }
 
     if (sCode.empty())
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoid.SetElCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoid.SetElCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Convert to a C++ string, for Mentor's sake
@@ -149,7 +149,7 @@
     char *pStr = Convert_Wide_To_UTF8(sCode.c_str()); //need to delete[] pStr
     if (NULL == pStr)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEllipsoid.SetElCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEllipsoid.SetElCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Try to make a legal name.  CS_nampp() legalizes the
@@ -161,7 +161,7 @@
     {
         //illegal string
         delete [] pStr;
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoid.SetElCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoid.SetElCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy into the definition
@@ -259,7 +259,7 @@
     bool bResult = BuildElDefFromInterface(pElDef, def);
     if (!bResult)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemEllipsoid.IsSameAs", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemEllipsoid.IsSameAs", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //And compare with this one!
@@ -292,7 +292,7 @@
 
     if (NULL == pDef.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEllipsoid.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEllipsoid.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy data members into the new object.  NOTE:  if new
@@ -324,7 +324,7 @@
     wchar_t *pDesc = Convert_UTF8_To_Wide(m_def.name);
     if (NULL == pDesc)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEllipsoid.GetDescription", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEllipsoid.GetDescription", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sDesc=pDesc;
     delete[] pDesc;
@@ -362,7 +362,7 @@
     wchar_t *pGroup = Convert_UTF8_To_Wide(m_def.group);
     if (NULL == pGroup)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEllipsoid.GetGroup", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEllipsoid.GetGroup", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     sGroup=pGroup;
     delete[] pGroup;
@@ -399,7 +399,7 @@
     wchar_t *pSource = Convert_UTF8_To_Wide(m_def.source);
     if (NULL == pSource)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEllipsoid.GetSource", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEllipsoid.GetSource", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     STRING sSource(pSource);
     delete[] pSource;
@@ -511,7 +511,7 @@
     if (Protected())
     {
         //can't change a read-only object
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemEllipsoid.SetRadii", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemEllipsoidProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemEllipsoid.SetRadii", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemEllipsoidProtectedException", NULL);
     }
 
     //Make sure the radii are mathematically valid
@@ -518,7 +518,7 @@
     if (!IsLegalEllipsoidRadius(dEquatorialRadius)
         || !IsLegalEllipsoidRadius(dPolarRadius))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoid.SetRadii", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoid.SetRadii", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Make sure the flattening ratio is legitimate
@@ -525,7 +525,7 @@
     double dFlat = FlatteningRatio(dEquatorialRadius, dPolarRadius);
     if (!::IsLegalFlatteningRatio(dFlat))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoid.SetRadii", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoid.SetRadii", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Okay, everything's kosher, store the values.
@@ -552,7 +552,7 @@
     assert(dFlat <= 1.0);
     if ((dFlat < 0.0) || (dFlat > 1.0))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoid.FlatteningRatioToEccentricity", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoid.FlatteningRatioToEccentricity", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     dEccent = Eccentricity(dFlat);
@@ -577,7 +577,7 @@
     assert(dEccent <= 1.0);
     if ((dEccent < 0.0) || (dEccent > 1.0))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoid.EccentToFlat", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoid.EccentToFlat", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     dFlat = FlatteningRatio(dEccent);
@@ -602,7 +602,7 @@
     assert(dFlatteningRatio < 1.0);
     if ((dFlatteningRatio < 0.0) || (dFlatteningRatio >= 1.0))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoid.EquatorialRadiusFromPolarRadiusFlatteningRatio", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoid.EquatorialRadiusFromPolarRadiusFlatteningRatio", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     dEquatorialRadius = dPolarRadius / (1.0 - dFlatteningRatio);
@@ -627,7 +627,7 @@
     assert(dFlatteningRatio < 1.0);
     if ((dFlatteningRatio < 0.0) || (dFlatteningRatio >= 1.0))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoid.PolarRadiusFromEquatorialRadiusFlatteningRatio", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoid.PolarRadiusFromEquatorialRadiusFlatteningRatio", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     dPolarRadius = dEquatorialRadius * (1.0 - dFlatteningRatio);
@@ -787,11 +787,11 @@
 
     if (!IsLegalEllipsoidRadius(dEquatorialRadius))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoid.FlatteningRatioFromRadii", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoid.FlatteningRatioFromRadii", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     if (!IsLegalEllipsoidRadius(dPolarRadius))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoid.FlatteningRatioFromRadii", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoid.FlatteningRatioFromRadii", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     dFlat = FlatteningRatio(dEquatorialRadius, dPolarRadius);
@@ -815,7 +815,7 @@
     assert(NULL != pStream);
     if (!pStream)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoid.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoid.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     UINT8 nVersion=pStreamOut[0];
@@ -851,7 +851,7 @@
         {
             m_bEncrypted = bPrevEncrypted;
             m_def = prevDef;
-            throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoid.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoid.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
 
@@ -868,7 +868,7 @@
     assert(NULL != pStream);
     if (!pStream)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoid.SerializeTo", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoid.SerializeTo", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //save the version

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEllipsoidDictionary.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEllipsoidDictionary.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEllipsoidDictionary.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -253,7 +253,7 @@
 
     if (NULL == pNewDef.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEllipsoidDictionary.NewEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEllipsoidDictionary.NewEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoidDictionary.NewEllipsoid")
@@ -285,7 +285,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(sFileName);
-        throw new MgFileIoException(L"MgCoordinateSystemEllipsoidDictionary.SetFileName", __LINE__, __WFILE__, &arguments, L"MgInvalidArgumentException", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"MgCoordinateSystemEllipsoidDictionary.SetFileName", __LINE__, __WFILE__, &arguments, L"MgInvalidArgumentException", NULL);
     }
 
     MentorDictionary::SetFileName(
@@ -352,7 +352,7 @@
     nSize=(ulFileBytes - sizeof(m_lMagic)) / sizeof(cs_Eldef_);
     if (0!=CS_fclose(pFile))
     {
-        throw new MgFileIoException(L"MgCoordinateSystemEllipsoidDictionary.GetSize", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"MgCoordinateSystemEllipsoidDictionary.GetSize", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemEllipsoidDictionary.GetSize")
 
@@ -379,7 +379,7 @@
     MgCoordinateSystemEllipsoid* pEllipsoidDef=dynamic_cast<MgCoordinateSystemEllipsoid*>(pDefinition);
     if (!pEllipsoidDef)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoidDictionary.Add", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoidDictionary.Add", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     MentorDictionary::UpdateDef<cs_Eldef_, MgCoordinateSystemEllipsoid>(
@@ -429,7 +429,7 @@
     MgCoordinateSystemEllipsoid* pEllipsoidDef=dynamic_cast<MgCoordinateSystemEllipsoid*>(pDefinition);
     if (!pEllipsoidDef)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoidDictionary.Modify", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoidDictionary.Modify", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     MentorDictionary::UpdateDef<cs_Eldef_, MgCoordinateSystemEllipsoid>(
@@ -475,7 +475,7 @@
         //wasn't there!
         MgStringCollection whatArguments;
         whatArguments.Add(sName);
-        throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemEllipsoidDictionary.GetEllipsoid", __LINE__, __WFILE__, &whatArguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemEllipsoidDictionary.GetEllipsoid", __LINE__, __WFILE__, &whatArguments, L"", NULL);
     }
 
     //Okay, at this point we have a Mentor ellipsoid definition
@@ -508,7 +508,7 @@
 
     if (NULL == pEllipsoidDef.p)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemEllipsoidDictionary.GetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemEllipsoidDictionary.GetEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     return pEllipsoidDef.Detach();
@@ -526,7 +526,7 @@
     char *pName = Convert_Wide_To_UTF8(sName.c_str()); //need to delete [] pName
     if (NULL == pName)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEllipsoidDictionary.Has", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEllipsoidDictionary.Has", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     if (NULL != m_pmapSystemNameDescription)
@@ -579,7 +579,7 @@
 
     //close the file before calling into the [read all CS-Map defs] method
     if (0 != CS_fclose(pFile))
-        throw new MgFileIoException(L"MgCoordinateSystemDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"MgCoordinateSystemDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
 
     pFile = NULL;
 
@@ -592,7 +592,7 @@
             CS_eldefAll);
         if (NULL == m_pmapSystemNameDescription)
         {
-            throw new MgInvalidArgumentException(L"MgCoordinateSystemEllipsoidDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEllipsoidDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
 
@@ -601,7 +601,7 @@
 
     if (pFile && 0 != CS_fclose(pFile))
     {
-        throw new MgFileIoException(L"MgCoordinateSystemEllipsoidDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"MgCoordinateSystemEllipsoidDictionary.GetEnum", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
     }
 
     pFile = NULL;
@@ -630,7 +630,7 @@
 
     CCoordinateSystemEllipsoidDictionary* ellipsoidDictionary = dynamic_cast<CCoordinateSystemEllipsoidDictionary*>(targetDictionary);
     if (NULL == ellipsoidDictionary)
-        throw new MgInvalidArgumentException(L"CCoordinateSystemEllipsoidDictionary.ReadAllEllipsoids", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"CCoordinateSystemEllipsoidDictionary.ReadAllEllipsoids", __LINE__, __WFILE__, NULL, L"", NULL);
 
     return MentorDictionary::ReadAllDefinitions<MgCoordinateSystemEllipsoid, cs_Eldef_, CCoordinateSystemEllipsoidDictionary>(
         ellipsoidDictionary,

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnum.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnum.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnum.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -104,7 +104,7 @@
     pOutput=new MgDisposableCollection;
     if (!pOutput)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //optimization:
@@ -136,7 +136,7 @@
         wchar_t* pStr = Convert_UTF8_To_Wide(kpName);
         if (NULL == pStr)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         STRING str(pStr);
@@ -147,7 +147,7 @@
         {
             MgStringCollection arguments;
             arguments.Add(str);
-            throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
 
         //is it filtered out?
@@ -173,7 +173,7 @@
     pOutput=new MgStringCollection;
     if (!pOutput)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.NextName", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.NextName", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     for (; m_iter != m_pmapSystemNameDescription->end(); ++m_iter)
     {
@@ -190,7 +190,7 @@
         wchar_t *pwName = Convert_UTF8_To_Wide(kpName);
         if (NULL == pwName)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.NextName", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.NextName", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         pOutput->Add(pwName);
         delete[] pwName;
@@ -208,7 +208,7 @@
     pOutput=new MgStringCollection;
     if (!pOutput)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.NextDescription", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.NextDescription", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     for (; m_iter != m_pmapSystemNameDescription->end(); ++m_iter)
     {
@@ -225,7 +225,7 @@
         wchar_t *pwDecsription = Convert_UTF8_To_Wide(kpDecsription);
         if (NULL == pwDecsription)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.NextDescription", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.NextDescription", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         pOutput->Add(pwDecsription);
         delete[] pwDecsription;
@@ -261,7 +261,7 @@
 
     if (ulSkipCount != ulSkipped)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEnum.Skip", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEnum.Skip", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.Skip")
@@ -300,7 +300,7 @@
     wchar_t* pStr = Convert_UTF8_To_Wide(kpName);
     if (NULL == pStr)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.IsFilteredOut", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.IsFilteredOut", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     STRING str(pStr);
     delete[] pStr;
@@ -310,7 +310,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(str);
-        throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemEnum.IsFilteredOut", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemEnum.IsFilteredOut", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     //Evaluate it
@@ -360,7 +360,7 @@
 
     if (NULL == pNew.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy data members into the new object.  NOTE:  if new

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumCategory.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumCategory.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumCategory.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -100,7 +100,7 @@
     wchar_t* pStr = Convert_UTF8_To_Wide(kpName);
     if (NULL == pStr)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.IsFilteredOut", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.IsFilteredOut", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     STRING str(pStr);
     delete[] pStr;
@@ -110,7 +110,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(str);
-        throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemEnum.IsFilteredOut", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemEnum.IsFilteredOut", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     //Evaluate it
@@ -155,7 +155,7 @@
     pOutput=new MgDisposableCollection;
     if (!pOutput)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     wchar_t* pStr;
@@ -173,7 +173,7 @@
         pStr = Convert_UTF8_To_Wide(kpName);
         if (NULL == pStr)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         STRING str(pStr);
         delete[] pStr;
@@ -183,7 +183,7 @@
         {
             MgStringCollection arguments;
             arguments.Add(str);
-            throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
 
         //check if this category is filtered out or not
@@ -211,7 +211,7 @@
     pOutput=new MgStringCollection;
     if (!pOutput)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.NextName", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.NextName", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     for (; m_iter != m_pCategoryNameList->end(); ++m_iter)
@@ -231,7 +231,7 @@
         wchar_t *pwName = Convert_UTF8_To_Wide(kpName);
         if (NULL == pwName)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.NextName", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.NextName", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         pOutput->Add(pwName);
         delete[] pwName;
@@ -244,7 +244,7 @@
 //----------------------------------------------------------
 MgStringCollection* CCoordinateSystemEnumCategory::NextDescription(UINT32 ulCount)
 {
-    throw new MgNotImplementedException(L"MgCoordinateSystemEnum.NextDescription", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgCoordinateSystemEnum.NextDescription", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 //----------------------------------------------------------
@@ -273,7 +273,7 @@
 
     if (ulSkipCount != ulSkipped)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEnum.Skip", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEnum.Skip", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.Skip")
@@ -303,7 +303,7 @@
 
     if (NULL == pNew.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy it from this one

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumCoordinateSystemInCategory.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumCoordinateSystemInCategory.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumCoordinateSystemInCategory.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -98,18 +98,18 @@
     pOutput=new MgDisposableCollection;
     if (!pOutput)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     if (!m_pCatalog)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemEnum.Next", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     Ptr<MgCoordinateSystemDictionary> pCsDict = m_pCatalog->GetCoordinateSystemDictionary();
     if (!pCsDict)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.Next", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDictionaryException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.Next", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDictionaryException", NULL);
     }
 
     for (; m_iter != this->m_csNames.end(); ++m_iter)
@@ -201,7 +201,7 @@
 
     if (ulSkipCount != ulSkipped)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEnum.Skip", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEnum.Skip", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystemEnum.Skip")
@@ -235,12 +235,12 @@
 
     if (!m_pCatalog)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemEnum.IsFilteredOut", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemEnum.IsFilteredOut", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     Ptr<MgCoordinateSystemDictionary> pCsDict=m_pCatalog->GetCoordinateSystemDictionary();
     if (!pCsDict)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.IsFilteredOut", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDictionaryException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystem.IsFilteredOut", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDictionaryException", NULL);
     }
 
     //Get a def from the set for the Filter to work with
@@ -251,7 +251,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(str);
-        throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemEnum.IsFilteredOut", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemEnum.IsFilteredOut", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     //Evaluate it

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumDatum.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumDatum.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumDatum.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -49,7 +49,7 @@
 
     if (NULL == pNew.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy data members into the new object.  NOTE:  if new

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumEllipsoid.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumEllipsoid.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumEllipsoid.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -49,7 +49,7 @@
 
     if (NULL == pNew.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEnum.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnum.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy data members into the new object.  NOTE:  if new

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumInteger32.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumInteger32.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysEnumInteger32.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -71,7 +71,7 @@
     m_pnValues = new INT32[ulSize];
     if (NULL == m_pnValues)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEnumInteger32.SetList", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnumInteger32.SetList", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy them in and return success
@@ -112,7 +112,7 @@
     pOutput=new MgIntCollection;
     if (!pOutput)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEnumInteger32.Next", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnumInteger32.Next", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     for (; m_ulPos < m_ulSize; m_ulPos++)
@@ -144,7 +144,7 @@
     pOutput=new MgStringCollection;
     if (!pOutput)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEnumInteger32.Next", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnumInteger32.Next", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     for (; m_ulPos < m_ulSize; m_ulPos++)
@@ -197,7 +197,7 @@
     }
     if (ulSkipCount != ulSkipped)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemEnumInteger32.Skip", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemEnumInteger32.Skip", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemEnumInteger32.Skip")
 }
@@ -251,7 +251,7 @@
 
     if (NULL == pNew.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemEnumInteger32.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemEnumInteger32.CreateClone", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy data members into the new object.  NOTE:  if new

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysFormatConverter.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysFormatConverter.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysFormatConverter.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -62,13 +62,13 @@
     if (wktFlvrUnknown==GetWktFlavor(nWktFlavor))
     {
         //invalid argument
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemFormatConverter.DefinitionToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemFormatConverter.DefinitionToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     bool bResult = BuildDefsFromInterface(pSource, pCsDef, pDtDef, pElDef);
     if (!bResult)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFormatConverter.DefinitionToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFormatConverter.DefinitionToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     if (ProjectionIsNerthType (pCsDef->prj_knm))
@@ -85,7 +85,7 @@
             wchar_t* pwszWkt=Convert_UTF8_To_Wide(csWktBufr);
             if (!pwszWkt)
             {
-                throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.DefinitionToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFormatConverter.DefinitionToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
             }
             sWkt=pwszWkt;
             delete[] pwszWkt;
@@ -159,11 +159,11 @@
             Ptr<CCoordinateSystem> pNew = new CCoordinateSystem(m_pCatalog);
             if (NULL == pNew.p)
             {
-                throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.WktToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFormatConverter.WktToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
             }
             else if (!pNew->InitArbitrary(csprm))
             {
-                throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFormatConverter.WktToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFormatConverter.WktToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
             }
             return pNew.Detach();
         }
@@ -172,7 +172,7 @@
     pszWkt = Convert_Wide_To_UTF8(sWkt.c_str());
     if (NULL == pszWkt)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.WktToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFormatConverter.WktToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     struct cs_Csdef_ csDef;
@@ -346,7 +346,7 @@
         //make a coordsys object
         if (!pCsDef || !pElDef)
         {
-            throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFormatConverter.WktToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFormatConverter.WktToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         //do we have a datum?
@@ -356,7 +356,7 @@
             Ptr<MgCoordinateSystemDatum> pDtDef=BuildInterfaceFromDtDef(dtDef, NULL);
             if (!pDtDef)
             {
-                throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFormatConverter.WktToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFormatConverter.WktToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
             }
             pDtDef->SetEllipsoidDefinition(pElDef);
             pCsDef->SetDatumDefinition(pDtDef);
@@ -387,7 +387,7 @@
         // Could not create the coordinate system from the WKT
         MgStringCollection arguments;
         arguments.Add(sWkt);
-        throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystemFormatConverter.WktToDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemFailedToCreateCoordinateSystemFromWkt", &arguments);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystemFormatConverter.WktToDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemFailedToCreateCoordinateSystemFromWkt", &arguments);
     }
     else
     {
@@ -432,7 +432,7 @@
     if (wktFlvrUnknown==GetWktFlavor(nWktFlavor))
     {
         //invalid argument
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     std::string szMsiName;
@@ -487,7 +487,7 @@
         char *pszCsSource = Convert_Wide_To_UTF8(sCodeSource.c_str());
         if (!pszCsSource)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         strName=pszCsSource;
         delete[] pszCsSource;
@@ -501,7 +501,7 @@
     else
     {
         //invalid source format
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //now get the WKT
@@ -511,7 +511,7 @@
     wchar_t* wszMsiName=Convert_UTF8_To_Wide(szMsiName.c_str());
     if (!wszMsiName)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     STRING strMsiName(wszMsiName);
     delete[] wszMsiName;
@@ -520,7 +520,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(strMsiName);
-        throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     INT32 prj=pCsCoordinateSystemDef->GetProjectionCode();
@@ -536,7 +536,7 @@
             wchar_t* wszWkt=Convert_UTF8_To_Wide(csWktBufr);
             if (!wszWkt)
             {
-                throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFormatConverter.CodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
             }
 
             sWkt=wszWkt;
@@ -581,7 +581,7 @@
     pszWkt = Convert_Wide_To_UTF8(sWkt.c_str());
     if (NULL == pszWkt)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.WktToCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFormatConverter.WktToCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //numbers in WKT string always use a dot a separator but the locale might say otherwise
@@ -693,7 +693,7 @@
             else
             {
                 //invalid format
-                throw new MgInvalidArgumentException(L"MgCoordinateSystemFormatConverter.WktToCode", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemFormatConverter.WktToCode", __LINE__, __WFILE__, NULL, L"", NULL);
             }
         }
     }
@@ -735,13 +735,13 @@
     STRING sCsSource=pSource->GetCsCode();
     if (sCsSource.empty())
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemFormatConverter.DefinitionToCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemFormatConverter.DefinitionToCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     pszCsSource = Convert_Wide_To_UTF8(sCsSource.c_str());
     if (NULL == pszCsSource)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.DefinitionToCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFormatConverter.DefinitionToCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //need to check if the system is in our dictionary
@@ -782,7 +782,7 @@
     else
     {
         //invalid format
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemFormatConverter.DefinitionToCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemFormatConverter.DefinitionToCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_CATCH(L"MgCoordinateSystemFormatConverter.DefinitionToCode")
@@ -803,7 +803,7 @@
     pszCsSource = Convert_Wide_To_UTF8(sCodeSource.c_str());
     if (NULL == pszCsSource)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFormatConverter.CodeToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     std::string szMsiName;
@@ -846,7 +846,7 @@
     else
     {
         //invalid format
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemFormatConverter.CodeToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemFormatConverter.CodeToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //now get the definition
@@ -857,7 +857,7 @@
         wchar_t* wszMsiName=Convert_UTF8_To_Wide(szMsiName.c_str());
         if (!wszMsiName)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFormatConverter.CodeToDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         STRING sMsiName(wszMsiName);
         delete[] wszMsiName;
@@ -869,7 +869,7 @@
         // Could not create the coordinate system from the code
         MgStringCollection arguments;
         arguments.Add(sCodeSource);
-        throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystemFormatConverter.CodeToDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemFailedToCreateCoordinateSystemFromCode", &arguments);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystemFormatConverter.CodeToDefinition", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemFailedToCreateCoordinateSystemFromCode", &arguments);
     }
 
     MG_CATCH(L"MgCoordinateSystemFormatConverter.CodeToDefinition")
@@ -890,7 +890,7 @@
     pszCsSource = Convert_Wide_To_UTF8(sCodeSource.c_str());
     if (NULL == pszCsSource)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFormatConverter.CodeToCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //if input is EPSG
@@ -929,7 +929,7 @@
                         wchar_t *pwszCsDestination=Convert_UTF8_To_Wide(szMsiName.c_str());
                         if (!pwszCsDestination)
                         {
-                            throw new MgOutOfMemoryException(L"MgCoordinateSystemFormatConverter.CodeToCode", __LINE__, __WFILE__, NULL, L"", NULL);
+                            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFormatConverter.CodeToCode", __LINE__, __WFILE__, NULL, L"", NULL);
                         }
                         sCsCodeDestination=pwszCsDestination;
                         delete[] pwszCsDestination;
@@ -944,7 +944,7 @@
             else
             {
                 //invalid format
-                throw new MgInvalidArgumentException(L"MgCoordinateSystemFormatConverter.CodeToCode", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemFormatConverter.CodeToCode", __LINE__, __WFILE__, NULL, L"", NULL);
             }
         }
     }
@@ -980,7 +980,7 @@
     else
     {
         //invalid format
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemFormatConverter.CodeToCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemFormatConverter.CodeToCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_CATCH(L"MgCoordinateSystemFormatConverter.CodeToCode")
@@ -1042,7 +1042,7 @@
     else
     {
         //invalid format
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemFormatConverter.IsCodeInDictionary", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemFormatConverter.IsCodeInDictionary", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystemFormatConverter.IsCodeInDictionary")
@@ -1088,7 +1088,7 @@
 
     if (NULL == pCsDict.p)
     {
-        throw new MgCoordinateSystemInitializationFailedException(
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, 
             L"MgCoordinateSystemFormatConverter.GetCoordinateSystem",
             __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoDictionaryException", NULL);
     }
@@ -1117,7 +1117,7 @@
     bool bResult=BuildCsDefFromInterface(pCsDef, def);
     if (!bResult)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFormatConverter.ConvertArbitraryToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFormatConverter.ConvertArbitraryToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     char* szWkt=CCsArbitraryCoordinateSystemUtil::ConvertCoordinateSystemToWkt(&def);

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticAnalyticalTransformDefParams.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticAnalyticalTransformDefParams.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticAnalyticalTransformDefParams.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -36,7 +36,7 @@
 {
     this->geocentricTransformParams = (csGeocentricXformParams*) CS_malc(sizeof(csGeocentricXformParams));
     if (NULL == this->geocentricTransformParams)
-        throw new MgOutOfMemoryException(L"CCoordinateSystemGeodeticAnalyticalTransformDefParams.Ctor", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"CCoordinateSystemGeodeticAnalyticalTransformDefParams.Ctor", __LINE__, __WFILE__, NULL, L"", NULL);
 
     *this->geocentricTransformParams = params;
 }
@@ -104,7 +104,7 @@
         break;
 
     default:
-        throw new MgInvalidArgumentException(L"CCoordinateSystemGeodeticAnalyticalTransformDefParams.SetTransformationMethod", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"CCoordinateSystemGeodeticAnalyticalTransformDefParams.SetTransformationMethod", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     this->transformationMethod = analyticalMethodCode;

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticInterpolationTransformDefParams.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticInterpolationTransformDefParams.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticInterpolationTransformDefParams.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -57,7 +57,7 @@
 
     this->gridFileParams = (csGridFileXformParams*) CS_malc(sizeof(csGridFileXformParams));
     if (NULL == this->gridFileParams)
-        throw new MgOutOfMemoryException(L"CCoordinateSystemGeodeticInterpolationTransformDefParams.Reset", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"CCoordinateSystemGeodeticInterpolationTransformDefParams.Reset", __LINE__, __WFILE__, NULL, L"", NULL);
 
     memset(this->gridFileParams, 0, sizeof(csGridFileXformParams));
 }
@@ -80,7 +80,7 @@
     ENSURE_NOT_NULL(gridFiles, L"CCoordinateSystemGeodeticInterpolationTransformDefParams.SetGridFileNames");
     const INT32 fileNamesCount = gridFiles->GetCount();
     if (fileNamesCount > csGRIDI1_FILEMAX)
-        throw new MgInvalidArgumentException(L"CCoordinateSystemGeodeticInterpolationTransformDefParams.SetGridFiles", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"CCoordinateSystemGeodeticInterpolationTransformDefParams.SetGridFiles", __LINE__, __WFILE__, NULL, L"", NULL);
 
     bool emptyFileCollection = (0 == fileNamesCount);
     csGeodeticXfromParmsFile_* allFiles = emptyFileCollection ? NULL : new csGeodeticXfromParmsFile_[fileNamesCount];
@@ -95,11 +95,11 @@
         Ptr<MgDisposable> gridFile = gridFiles->GetItem(i); //calls [AddRef] on the item being returned
         CCoordinateSystemGeodeticTransformGridFile* gridFileSetting = dynamic_cast<CCoordinateSystemGeodeticTransformGridFile*>(gridFile.p);
         if (NULL == gridFileSetting)
-            throw new MgInvalidArgumentException(L"CCoordinateSystemGeodeticInterpolationTransformDefParams.SetGridFiles", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"CCoordinateSystemGeodeticInterpolationTransformDefParams.SetGridFiles", __LINE__, __WFILE__, NULL, L"", NULL);
 
         //we only allow for setting valid grid files
         if (!gridFileSetting->IsValid())
-            throw new MgInvalidArgumentException(L"CCoordinateSystemGeodeticInterpolationTransformDefParams.SetGridFiles", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"CCoordinateSystemGeodeticInterpolationTransformDefParams.SetGridFiles", __LINE__, __WFILE__, NULL, L"", NULL);
 
         //take the values from the settings we have been passed here and set our internal
         //[csGridFileXFormat] instance at index [i] to those values

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticMultipleRegressionTransformDefParams.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticMultipleRegressionTransformDefParams.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticMultipleRegressionTransformDefParams.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -58,7 +58,7 @@
 
     this->mulRegParams = (csMultipleRegressionXformParams*) CS_malc(sizeof(csMultipleRegressionXformParams));
     if (NULL == this->mulRegParams)
-        throw new MgOutOfMemoryException(L"CCoordinateSystemGeodeticMultipleRegressionTransformDefParams.Reset", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"CCoordinateSystemGeodeticMultipleRegressionTransformDefParams.Reset", __LINE__, __WFILE__, NULL, L"", NULL);
 
     memset(this->mulRegParams, 0, sizeof(csMultipleRegressionXformParams));
 }
@@ -108,7 +108,7 @@
         break;
 
     default:
-        throw new MgInvalidArgumentException(L"CCoordinateSystemGeodeticMultipleRegressionTransformDefParams.SetTransformationMethod", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"CCoordinateSystemGeodeticMultipleRegressionTransformDefParams.SetTransformationMethod", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     this->transformationMethod = mulRegTransformationMethod;

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticPath.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticPath.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticPath.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -63,7 +63,7 @@
     this->pathDefinition = (cs_GeodeticPath_*)CS_malc(sizeof(cs_GeodeticPath_));
 
     if (NULL == this->pathDefinition)
-        throw new MgOutOfMemoryException(L"CCoordinateSystemGeodeticPath.Initialize", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"CCoordinateSystemGeodeticPath.Initialize", __LINE__, __WFILE__, NULL, L"", NULL);
 
     memset ((void*)this->pathDefinition, 0, sizeof(cs_GeodeticPath_));
 }
@@ -156,7 +156,7 @@
 
     const INT32 pathElementCount = pathElements->GetCount();
     if (0 == pathElementCount || pathElementCount > csPATH_MAXXFRM)
-        throw new MgInvalidArgumentException(L"CCoordinateSystemGeodeticPath.SetPathElements", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"CCoordinateSystemGeodeticPath.SetPathElements", __LINE__, __WFILE__, NULL, L"", NULL);
 
     cs_GeodeticPathElement_* validElements = new cs_GeodeticPathElement_[pathElementCount];
 
@@ -170,7 +170,7 @@
         Ptr<MgDisposable> collectionItem = pathElements->GetItem(i);
         MgCoordinateSystemGeodeticPathElement* pathElement = dynamic_cast<MgCoordinateSystemGeodeticPathElement*>(collectionItem.p);
         if (NULL == pathElement)
-            throw new MgInvalidArgumentException(L"CCoordinateSystemGeodeticPath.SetPathElements", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"CCoordinateSystemGeodeticPath.SetPathElements", __LINE__, __WFILE__, NULL, L"", NULL);
 
         cs_GeodeticPathElement_& pathElementDef = validElements[i];
 
@@ -216,7 +216,7 @@
     assert(NULL != pStream);
     if (!pStream)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemGeodeticPath.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemGeodeticPath.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     UINT8 nVersion=pStreamOut[0];
@@ -231,7 +231,7 @@
         if (pathDefinition == NULL)
         {
             this->pathDefinition = previousPathPtr;
-            throw new MgOutOfMemoryException (L"MgCoordinateSystemGeodeticPath.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemGeodeticPath.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         memcpy(pathDefinition, pStreamOut, sizeof(cs_GeodeticPath_));
         pStreamOut = pStreamOut + sizeof(cs_GeodeticPath_);
@@ -241,7 +241,7 @@
         {
             CS_free (this->pathDefinition);
             this->pathDefinition = previousPathPtr;
-            throw new MgInvalidArgumentException(L"MgCoordinateSystemGeodeticPath.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemGeodeticPath.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         CS_free (previousPathPtr);
     }
@@ -259,7 +259,7 @@
     assert(NULL != pStream);
     if (!pStream)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemGeodeticPath.SerializeTo", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemGeodeticPath.SerializeTo", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //save the version

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticPathDictionary.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticPathDictionary.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticPathDictionary.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -180,11 +180,8 @@
     {
         return static_cast<MgCoordinateSystemGeodeticPath*>(this->m_pDictionary->Get(sName));
     }
-    catch(MgCoordinateSystemLoadFailedException* loadFailedException)
-    {
-        //catch only the [MgCoordinateSystemLoadFailedException] and release it right away
-        loadFailedException->Release();
-    }
+    //catch only the [MgCoordinateSystemLoadFailedException] and release it right away
+    MG_CATCH_AND_RELEASE_IF_TYPE(MgCoordinateSystemLoadFailedException)
 
     return NULL;
 }

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticPathElement.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticPathElement.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticPathElement.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -61,7 +61,7 @@
 {
     cs_GeodeticPathElement_* tempPathElement = (cs_GeodeticPathElement_*) CS_malc(sizeof(cs_GeodeticPathElement_));
     if (NULL == tempPathElement)
-        throw new MgOutOfMemoryException(L"CCoordinateSystemGeodeticPathElement.Reset", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"CCoordinateSystemGeodeticPathElement.Reset", __LINE__, __WFILE__, NULL, L"", NULL);
 
     MG_TRY()
 

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticStandaloneTransformDefParams.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticStandaloneTransformDefParams.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticStandaloneTransformDefParams.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -77,7 +77,7 @@
         break;
 
     default:
-        throw new MgInvalidArgumentException(L"CCoordinateSystemGeodeticStandaloneDefParams.SetTransformationMethod", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"CCoordinateSystemGeodeticStandaloneDefParams.SetTransformationMethod", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     this->m_nStandaloneMethodCode = standaloneMethodCode;

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticTransformDef.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticTransformDef.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticTransformDef.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -78,13 +78,13 @@
         break;
 
     default:
-        throw new MgInvalidArgumentException(L"CCoordinateSystemGeodeticTransformDef.Reset", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"CCoordinateSystemGeodeticTransformDef.Reset", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //try creating a new [cs_GeodeticTransform_] instance before we wipe out our own stuff
     cs_GeodeticTransform_* newEmptyDef = (cs_GeodeticTransform_*)CS_malc(sizeof(cs_GeodeticTransform_));
     if (NULL == newEmptyDef) //uses CS_malc which returns NULL in case allocation fails
-        throw new MgOutOfMemoryException(L"CCoordinateSystemGeodeticTransformDef.Initialize", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"CCoordinateSystemGeodeticTransformDef.Initialize", __LINE__, __WFILE__, NULL, L"", NULL);
 
     MG_TRY()
 
@@ -160,7 +160,7 @@
         break;
 
     default: //invalid / unknown [methodCode] given; don't know how to proceed here
-        throw new MgInvalidArgumentException(L"CCoordinateSystemGeodeticTransformDef.Initialize", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"CCoordinateSystemGeodeticTransformDef.Initialize", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     return transformationType;
@@ -181,7 +181,7 @@
     VERIFY_INITIALIZED(L"CCoordinateSystemGeodeticTransformDef.CreateTransformation");
 
     if (!this->IsValid())
-        throw new MgInvalidOperationException(L"CCoordinateSystemGeodeticTransformDef.CreateTransformation", __LINE__,__WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"CCoordinateSystemGeodeticTransformDef.CreateTransformation", __LINE__,__WFILE__, NULL, L"", NULL);
 
     //we don't take ownership of the transformation being returned but
     //will release [sourceDatum] and [targetDatum];
@@ -242,7 +242,7 @@
 
     default: //invalid state; why's that?
         _ASSERT(false);
-        throw new MgInvalidOperationException(L"CCoordinateSystemGeodeticTransformDef.GetParameters", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"CCoordinateSystemGeodeticTransformDef.GetParameters", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 }
 
@@ -314,7 +314,7 @@
     }
 
     if (NULL == transformDefParams)
-        throw new MgInvalidOperationException(L"CCoordinateSystemGeodeticTransformDef.SetParameters", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"CCoordinateSystemGeodeticTransformDef.SetParameters", __LINE__, __WFILE__, NULL, L"", NULL);
 
     //copy the values from the parameter we've been passed into our own [parameters] section
     transformDefParams->CopyTo(&this->transformDefinition->parameters);
@@ -380,7 +380,7 @@
     assert(NULL != pStream);
     if (!pStream)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemGeodeticTransformDef.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemGeodeticTransformDef.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     // In case an exception gets thrown.
@@ -400,7 +400,7 @@
         //Read the def from the stream
         allocatedBlock = (cs_GeodeticTransform_*)CS_malc(sizeof(cs_GeodeticTransform_));
         if (NULL == allocatedBlock)
-            throw new MgOutOfMemoryException (L"MgCoordinateSystemGeodeticTransformDef.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemGeodeticTransformDef.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
 
         this->transformDefinition = allocatedBlock;
 
@@ -422,7 +422,7 @@
             // Nope!  It's not valid, but not valid in such a way that would cause
             // an exception to be thrown.  transformationDefinition cannot be
             // NULL at this point.
-            throw new MgInvalidArgumentException(L"MgCoordinateSystemGeodeticTransformDef.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemGeodeticTransformDef.SerializeFrom", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
 
@@ -452,7 +452,7 @@
     assert(NULL != pStream);
     if (!pStream)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemGeodeticTransformDef.SerializeTo", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemGeodeticTransformDef.SerializeTo", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //save the version

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticTransformDefDictionary.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticTransformDefDictionary.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticTransformDefDictionary.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -86,11 +86,8 @@
     {
         return static_cast<MgCoordinateSystemGeodeticTransformDef*>(this->m_pDictionary->Get(transformationName));
     }
-    catch(MgCoordinateSystemLoadFailedException* loadFailedException)
-    {
-        //catch only the [MgCoordinateSystemLoadFailedException] and release it right away
-        loadFailedException->Release();
-    }
+    //catch only the [MgCoordinateSystemLoadFailedException] and release it right away
+    MG_CATCH_AND_RELEASE_IF_TYPE(MgCoordinateSystemLoadFailedException)
 
     return NULL;
 }

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticTransformGridFile.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticTransformGridFile.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticTransformGridFile.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -38,7 +38,7 @@
 {
     this->gridFileDesc = (csGeodeticXfromParmsFile_*)CS_malc(sizeof(csGeodeticXfromParmsFile_));
     if (NULL == this->gridFileDesc)
-        throw new MgOutOfMemoryException(L"CCoordinateSystemGeodeticAnalyticalTransformDefParams.ctor", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"CCoordinateSystemGeodeticAnalyticalTransformDefParams.ctor", __LINE__, __WFILE__, NULL, L"", NULL);
 
     ::memset(this->gridFileDesc, 0, sizeof(csGeodeticXfromParmsFile_));
     if (NULL != fileFormatParam)

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticTransformation.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticTransformation.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGeodeticTransformation.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -93,7 +93,7 @@
     MgCoordinateSystemDatum *pSourceTmp=GetWGS84IfNull(pSource);
     if (!pSourceTmp)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotFoundException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotFoundException", NULL);
     }
     CCoordinateSystemDatum* pDtSourceImp=dynamic_cast<CCoordinateSystemDatum*>(pSourceTmp);
     assert(pDtSourceImp);
@@ -104,7 +104,7 @@
         {
             SAFE_RELEASE(pSourceTmp);
         }
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotFoundException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotFoundException", NULL);
     }
 
     //Set up our target datum
@@ -116,7 +116,7 @@
         {
             SAFE_RELEASE(pSourceTmp);
         }
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotFoundException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotFoundException", NULL);
     }
     CCoordinateSystemDatum* pDtTargetImp=dynamic_cast<CCoordinateSystemDatum*>(pTargetTmp);
     assert(pDtTargetImp);
@@ -132,7 +132,7 @@
         {
             SAFE_RELEASE(pTargetTmp);
         }
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotFoundException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotFoundException", NULL);
     }
 
     //Set up our datum conversion struct
@@ -142,7 +142,7 @@
     assert(pDtcprm);
     if (!pDtcprm)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemGeodeticTransformationSetupException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemGeodeticTransformationSetupException", NULL);
     }
 
     Uninitialize();
@@ -176,7 +176,7 @@
     //Make sure we're initialized
     if (!IsInitialized())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.GetSource", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.GetSource", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     return SAFE_ADDREF(m_pDtSource);
@@ -191,7 +191,7 @@
     //Make sure we're initialized
     if (!IsInitialized())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.GetTarget", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.GetTarget", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     return SAFE_ADDREF(m_pDtTarget);
@@ -227,12 +227,12 @@
     if (1==nResult)
     {
         // Partial failure - Outside the useful range.
-        throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystemGeodeticTransformation.Shift", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionWarningException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystemGeodeticTransformation.Shift", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionWarningException", NULL);
     }
     else if (-1==nResult)
     {
         // Total failure - Outside the mathematical domain.
-        throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystemGeodeticTransformation.Shift", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionExtentException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystemGeodeticTransformation.Shift", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionExtentException", NULL);
     }
     pLonLat->SetX(dLongitude);
     pLonLat->SetY(dLatitude);
@@ -270,18 +270,18 @@
     if (1==nResult)
     {
         // Partial failure - Outside the useful range.
-        throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystemGeodeticTransformation.Shift", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionWarningException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystemGeodeticTransformation.Shift", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionWarningException", NULL);
     }
     else if (-1==nResult)
     {
         // Total failure - Outside the mathematical domain.
-        throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystemGeodeticTransformation.Shift", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionExtentException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystemGeodeticTransformation.Shift", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionExtentException", NULL);
     }
 
     pCoord=new MgCoordinateXY(dLongitude, dLatitude);
     if (!pCoord)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemGeodeticTransformation.Shift", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemGeodeticTransformation.Shift", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.Shift")
     return pCoord.Detach();
@@ -316,18 +316,18 @@
     if (1==nResult)
     {
         // Partial failure - Outside the useful range.
-        throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystemGeodeticTransformation.Shift", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionWarningException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystemGeodeticTransformation.Shift", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionWarningException", NULL);
     }
     else if (-1==nResult)
     {
         // Total failure - Outside the mathematical domain.
-        throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystemGeodeticTransformation.Shift", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionExtentException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystemGeodeticTransformation.Shift", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionExtentException", NULL);
     }
 
     pCoord=new MgCoordinateXYZ(dLongitude, dLatitude, dZ);
     if (!pCoord)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemGeodeticTransformation.Shift", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemGeodeticTransformation.Shift", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.Shift")
@@ -374,7 +374,7 @@
 
     CCoordinateSystemGeodeticTransformDef* transformDefImpl = dynamic_cast<CCoordinateSystemGeodeticTransformDef*>(transformationDef);
     if (NULL == transformDefImpl)
-        throw new MgInvalidArgumentException(L"CCoordinateSystemGeodeticTransformation.SetupFromTransformationDef", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"CCoordinateSystemGeodeticTransformation.SetupFromTransformationDef", __LINE__, __WFILE__, NULL, L"", NULL);
 
     cs_GeodeticTransform_ csMapTransformDef;
     transformDefImpl->CopyTo(csMapTransformDef);
@@ -383,7 +383,7 @@
     datumTransform = CSdtcsu2(&csMapTransformDef, createInversed ? cs_DTCDIR_INV : cs_DTCDIR_FWD, cs_DTCFLG_BLK_W);
 
     if (NULL == datumTransform)
-        throw new MgInvalidArgumentException(L"CCoordinateSystemGeodeticTransformation.SetupFromTransformationDef", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"CCoordinateSystemGeodeticTransformation.SetupFromTransformationDef", __LINE__, __WFILE__, NULL, L"", NULL);
 
     Ptr<MgCoordinateSystemDatumDictionary> datumDictionary = this->m_pCatalog->GetDatumDictionary();
     Ptr<MgCoordinateSystemDatum> srcDatum = datumDictionary->GetDatum(transformationDef->GetSourceDatum());
@@ -491,7 +491,7 @@
     cs_Dtdef_ def;
     if (!GetDefinitionForGeodeticTransformationParameter(def))
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.GetOffsetX", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.GetOffsetX", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
     dResult=def.delta_X;
 
@@ -508,7 +508,7 @@
     cs_Dtdef_ def;
     if (!GetDefinitionForGeodeticTransformationParameter(def))
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.GetOffsetY", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.GetOffsetY", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
     dResult=def.delta_Y;
     MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.GetOffsetY")
@@ -524,7 +524,7 @@
     cs_Dtdef_ def;
     if (!GetDefinitionForGeodeticTransformationParameter(def))
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.GetOffsetZ", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.GetOffsetZ", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
     dResult=def.delta_Z;
     MG_CATCH_AND_THROW(L"MgCoordinateSystemGeodeticTransformation.GetOffsetZ")
@@ -546,12 +546,12 @@
     MG_TRY()
     if (!m_pDtSource || !m_pDtTarget)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetOffset", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetOffset", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     //if not WGS84 for the target system, bye bye!
     if (m_pDtTarget->GetDtCode()!=kpWGS84Datum)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetOffset", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetOffset", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     CCoordinateSystemDatum* pDatumImp=dynamic_cast<CCoordinateSystemDatum*>(m_pDtSource);
@@ -558,7 +558,7 @@
     assert(pDatumImp);
     if (!pDatumImp)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetOffset", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetOffset", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Make sure this object isn't read-only
@@ -565,7 +565,7 @@
     if (m_pDtSource->IsProtected())
     {
         //can't change a read-only object
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetOffset", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetOffset", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumProtectedException", NULL);
     }
 
     if (!IsLegalDatumOffset(x) ||
@@ -573,7 +573,7 @@
         !IsLegalDatumOffset(z))
     {
         //Caller gave us an illegal value.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemGeodeticTransformation.SetOffset", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemGeodeticTransformation.SetOffset", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     pDatumImp->m_DtDef.delta_X = pDatumImp->m_datum.delta_X = x;
@@ -605,7 +605,7 @@
     cs_Dtdef_ def;
     if (!GetDefinitionForGeodeticTransformationParameter(def))
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.GetBursaWolfeTransformRotationX", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.GetBursaWolfeTransformRotationX", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     dResult = def.rot_X;
@@ -623,7 +623,7 @@
     cs_Dtdef_ def;
     if (!GetDefinitionForGeodeticTransformationParameter(def))
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.GetBursaWolfeTransformRotationY", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.GetBursaWolfeTransformRotationY", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     dResult = def.rot_Y;
@@ -641,7 +641,7 @@
     cs_Dtdef_ def;
     if (!GetDefinitionForGeodeticTransformationParameter(def))
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.GetBursaWolfeTransformRotationZ", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.GetBursaWolfeTransformRotationZ", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     dResult = def.rot_Z;
@@ -659,7 +659,7 @@
     cs_Dtdef_ def;
     if (!GetDefinitionForGeodeticTransformationParameter(def))
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.GetBursaWolfeTransformBwScale", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.GetBursaWolfeTransformBwScale", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     dResult = def.bwscale;
@@ -685,12 +685,12 @@
 
     if (!m_pDtSource || !m_pDtTarget)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetBursaWolfeTransform", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetBursaWolfeTransform", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     //if not WGS84 for the target system, bye bye!
     if (m_pDtTarget->GetDtCode()!=kpWGS84Datum)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetBursaWolfeTransform", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetBursaWolfeTransform", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     CCoordinateSystemDatum* pDatumImp=dynamic_cast<CCoordinateSystemDatum*>(m_pDtSource);
@@ -697,7 +697,7 @@
     assert(pDatumImp);
     if (!pDatumImp)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetBursaWolfeTransform", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetBursaWolfeTransform", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Make sure this object isn't read-only
@@ -704,7 +704,7 @@
     if (m_pDtSource->IsProtected())
     {
         //can't change a read-only object
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetBursaWolfeTransform", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetBursaWolfeTransform", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumProtectedException", NULL);
     }
 
     if (!IsLegalDatumRotation(dRotationX) ||
@@ -713,7 +713,7 @@
         !::IsLegalBwScale(dBwScale))
     {
         //Caller gave us an illegal value.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemGeodeticTransformation.SetBursaWolfeTransform", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemGeodeticTransformation.SetBursaWolfeTransform", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     pDatumImp->m_DtDef.rot_X = pDatumImp->m_datum.rot_X = dRotationX;
@@ -767,12 +767,12 @@
 
     if (!m_pDtSource || !m_pDtTarget)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetGeodeticTransformationMethod", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetGeodeticTransformationMethod", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     //if not WGS84 for the target system, bye bye!
     if (m_pDtTarget->GetDtCode()!=kpWGS84Datum)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetGeodeticTransformationMethod", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetGeodeticTransformationMethod", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     CCoordinateSystemDatum* pDatumImp=dynamic_cast<CCoordinateSystemDatum*>(m_pDtSource);
@@ -779,7 +779,7 @@
     assert(pDatumImp);
     if (!pDatumImp)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetGeodeticTransformationMethod", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetGeodeticTransformationMethod", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Make sure this object isn't read-only
@@ -786,13 +786,13 @@
     if (m_pDtSource->IsProtected())
     {
         //can't change a read-only object
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemGeodeticTransformation.SetGeodeticTransformationMethod", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumProtectedException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemGeodeticTransformation.SetGeodeticTransformationMethod", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDatumProtectedException", NULL);
     }
 
     if (!IsLegalGeodeticTransformationMethod(nGeodeticTransformationMethod))
     {
         //Not one of the known datum conversion techniques.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemGeodeticTransformation.SetGeodeticTransformationMethod", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemGeodeticTransformation.SetGeodeticTransformationMethod", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     pDatumImp->m_DtDef.to84_via = pDatumImp->m_datum.to84_via = nGeodeticTransformationMethod;

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGrids.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGrids.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysGrids.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -183,7 +183,7 @@
     codeOk = GetUnitInfo(unitCode,&lclUnitType,NULL);
     if (!codeOk || unitType != lclUnitType)
     {
-        throw new MgInvalidCoordinateSystemUnitsException(L"MgCoordinateSystemGridSpecification.SetUnits",
+        throw new MgException(MgExceptionCodes::MgInvalidCoordinateSystemUnitsException, L"MgCoordinateSystemGridSpecification.SetUnits",
                                                           __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -353,7 +353,7 @@
     GetUnitInfo(trgUnitCode,&trgUnitType,NULL);
     if (trgUnitType != m_UnitType)
     {
-        throw new MgInvalidCoordinateSystemUnitsException(L"MgCoordinateSystemGridSpecification.ConvertUnitsOfValue", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidCoordinateSystemUnitsException, L"MgCoordinateSystemGridSpecification.ConvertUnitsOfValue", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     // Calculate the appropriate units conversion factor.  Since the unit types
@@ -428,7 +428,7 @@
 
         if (!swPnt|| !swPnt || !nePnt || !nwPnt ||!clPnt)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystemGridBoundary.SetBoundaryExtents",
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemGridBoundary.SetBoundaryExtents",
                                              __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
@@ -435,7 +435,7 @@
         collection = new MgCoordinateCollection();
         if (collection == NULL)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystemGridBoundary.SetBoundaryExtents",
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemGridBoundary.SetBoundaryExtents",
                                              __LINE__, __WFILE__, NULL, L"", NULL);
         }
         collection->Add (swPnt);
@@ -447,7 +447,7 @@
         Ptr<MgLinearRing> ring = factory.CreateLinearRing (collection);
         if (ring == 0)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystemGridBoundary.SetBoundaryExtents",
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemGridBoundary.SetBoundaryExtents",
                                              __LINE__, __WFILE__, NULL, L"", NULL);
         }
         m_GridBoundary = factory.CreatePolygon (ring,NULL);
@@ -983,7 +983,7 @@
 void CCoordinateSystemGridLineCollection::SetItem (INT32 index,MgCoordinateSystemGridLine* value)
 {
     if (GetAvailableMemory() < m_MemoryThreshold)
-        throw new MgGridDensityException(L"CCoordinateSystemGridLineCollection.SetItem", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgGridDensityException, L"CCoordinateSystemGridLineCollection.SetItem", __LINE__, __WFILE__, NULL, L"", NULL);
 
     m_GridLineCollection->SetItem (index,value);
 }
@@ -990,7 +990,7 @@
 void CCoordinateSystemGridLineCollection::Add (MgCoordinateSystemGridLine* value)
 {
     if (GetAvailableMemory() < m_MemoryThreshold)
-        throw new MgGridDensityException(L"CCoordinateSystemGridLineCollection.Add", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgGridDensityException, L"CCoordinateSystemGridLineCollection.Add", __LINE__, __WFILE__, NULL, L"", NULL);
 
     // The MgDIsposableCollection object does the "SAFE_ADDREF" operation.
     m_GridLineCollection->Add (value);
@@ -1057,7 +1057,7 @@
 void CCoordinateSystemGridRegionCollection::SetItem (INT32 index, MgCoordinateSystemGridRegion* value)
 {
     if (GetAvailableMemory() < m_MemoryThreshold)
-        throw new MgGridDensityException(L"CCoordinateSystemGridRegionCollection.SetItem", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgGridDensityException, L"CCoordinateSystemGridRegionCollection.SetItem", __LINE__, __WFILE__, NULL, L"", NULL);
 
     m_GridRegionCollection->SetItem (index,value);
 }
@@ -1064,7 +1064,7 @@
 void CCoordinateSystemGridRegionCollection::Add (MgCoordinateSystemGridRegion* value)
 {
     if (GetAvailableMemory() < m_MemoryThreshold)
-        throw new MgGridDensityException(L"CCoordinateSystemGridRegionCollection.Add", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgGridDensityException, L"CCoordinateSystemGridRegionCollection.Add", __LINE__, __WFILE__, NULL, L"", NULL);
 
     m_GridRegionCollection->Add (value);
 }
@@ -1133,7 +1133,7 @@
 void CCoordinateSystemGridTickCollection::SetItem (INT32 index, MgCoordinateSystemGridTick* value)
 {
     if (GetAvailableMemory() < m_MemoryThreshold)
-        throw new MgGridDensityException(L"CCoordinateSystemGridTickCollection.SetItem", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgGridDensityException, L"CCoordinateSystemGridTickCollection.SetItem", __LINE__, __WFILE__, NULL, L"", NULL);
 
     m_GridTickCollection->SetItem (index,value);
 }
@@ -1140,7 +1140,7 @@
 void CCoordinateSystemGridTickCollection::Add (MgCoordinateSystemGridTick* value)
 {
     if (GetAvailableMemory() < m_MemoryThreshold)
-        throw new MgGridDensityException(L"CCoordinateSystemGridTickCollection.Add", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgGridDensityException, L"CCoordinateSystemGridTickCollection.Add", __LINE__, __WFILE__, NULL, L"", NULL);
 
     m_GridTickCollection->Add (value);
 }

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysMacro.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysMacro.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysMacro.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -26,17 +26,17 @@
 
 #ifdef CS_MAP_DEF_VARIABLE
     #define VERIFY_INITIALIZED(x)   if (NULL == CS_MAP_DEF_VARIABLE) \
-        throw new MgInvalidOperationException(x, __LINE__, __WFILE__, NULL, L"", NULL)
+        throw new MgException(MgExceptionCodes::MgInvalidOperationException, x, __LINE__, __WFILE__, NULL, L"", NULL)
 #else
     #define VERIFY_INITIALIZED(x)
 #endif
 
 #define VERIFY_NOT_PROTECTED(x) if (this->IsProtected()) \
-    throw new MgCoordinateSystemInitializationFailedException(x, __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+    throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, x, __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
 
 #define ENSURE_NOT_NULL(param,method) \
     if (NULL == param) \
-        throw new MgNullArgumentException(method, __LINE__, __WFILE__, NULL, L"", NULL)
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, method, __LINE__, __WFILE__, NULL, L"", NULL)
 
 #define DEFINE_GET_STRING(x,y) STRING x::Get##y()
 #define DEFINE_SET_STRING(x,y) void x::Set##y(CREFSTRING propertyValue)
@@ -51,7 +51,7 @@
     { \
         VERIFY_INITIALIZED(MAKE_QUALIFIED_MEMBER_STRING(className,Set##propertyName)); \
         if (this->IsProtected()) \
-            throw new MgCoordinateSystemInitializationFailedException(MAKE_QUALIFIED_MEMBER_STRING(className,Set##propertyName), __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL); \
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, MAKE_QUALIFIED_MEMBER_STRING(className,Set##propertyName), __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL); \
         \
         MentorSetString(propertyValue, charBuffer /* target buffer */, sizeof(charBuffer)); \
     }
@@ -72,7 +72,7 @@
     { \
         VERIFY_INITIALIZED(MAKE_QUALIFIED_MEMBER_STRING(className,Set##propertyName)); \
         if (this->IsProtected()) \
-            throw new MgCoordinateSystemInitializationFailedException(MAKE_QUALIFIED_MEMBER_STRING(className,Set##propertyName), __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL); \
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, MAKE_QUALIFIED_MEMBER_STRING(className,Set##propertyName), __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL); \
         \
         target = propertyValue;\
     }
@@ -82,7 +82,7 @@
     { \
         VERIFY_INITIALIZED(MAKE_QUALIFIED_MEMBER_STRING(className,Get##propertyName)); \
         if (index < 0 || index > maxIdx) \
-            throw new MgArgumentOutOfRangeException(MAKE_QUALIFIED_MEMBER_STRING(className,Get##propertyName), __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL); \
+            throw new MgException(MgExceptionCodes::MgArgumentOutOfRangeException, MAKE_QUALIFIED_MEMBER_STRING(className,Get##propertyName), __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL); \
         \
         return target[index]; \
     } \
@@ -90,10 +90,10 @@
     { \
         VERIFY_INITIALIZED(MAKE_QUALIFIED_MEMBER_STRING(className,Set##propertyName)); \
         if (this->IsProtected()) \
-            throw new MgCoordinateSystemInitializationFailedException(MAKE_QUALIFIED_MEMBER_STRING(className,Set##propertyName), __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL); \
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, MAKE_QUALIFIED_MEMBER_STRING(className,Set##propertyName), __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL); \
         \
         if (index < 0 || index > maxIdx) \
-            throw new MgArgumentOutOfRangeException(MAKE_QUALIFIED_MEMBER_STRING(className,Get##propertyName), __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL); \
+            throw new MgException(MgExceptionCodes::MgArgumentOutOfRangeException, MAKE_QUALIFIED_MEMBER_STRING(className,Get##propertyName), __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL); \
         \
         target[index] = propertyValue;\
     }

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysMeasure.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysMeasure.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysMeasure.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -200,7 +200,7 @@
     pNew=new MgEnvelope(m_pCoordSys->GetMinX(), m_pCoordSys->GetMinY(), m_pCoordSys->GetMaxX(), m_pCoordSys->GetMaxY());
     if (NULL == pNew)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemMeasure.GetEnvelope", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemMeasure.GetEnvelope", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     return pNew;
 }

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysMgrs.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysMgrs.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysMgrs.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -131,7 +131,7 @@
     {
         if (m_bExceptionsOn)
         {
-            throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemMgrs.Init", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemMgrs.Init", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         else
         {
@@ -151,7 +151,7 @@
     {
         if (m_bExceptionsOn)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystemMgrs.InitFromEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemMgrs.InitFromEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         else
         {
@@ -172,7 +172,7 @@
     {
         if (m_bExceptionsOn)
         {
-            throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemMgrs.InitFromEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemMgrs.InitFromEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         else
         {
@@ -192,7 +192,7 @@
     {
         if (m_bExceptionsOn)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystemMgrs.InitFromDatum", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemMgrs.InitFromDatum", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         else
         {
@@ -213,7 +213,7 @@
     {
         if (m_bExceptionsOn)
         {
-            throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemMgrs.InitFromDatum", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemMgrs.InitFromDatum", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         else
         {
@@ -279,7 +279,7 @@
         {
             if (m_bExceptionsOn)
             {
-                throw new MgOutOfMemoryException(L"MgCoordinateSystemMgrs.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemMgrs.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
             }
             else
             {
@@ -405,7 +405,7 @@
     if (m_GridBoundary == 0)
     {
         // Proceeding without a grid boundary will cause a crash.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemMgrs.GetGridLines",
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemMgrs.GetGridLines",
                                                                    __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -463,7 +463,7 @@
     if (m_GridBoundary == 0)
     {
         // Proceeding without a grid boundary will cause a crash.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemMgrs.GetGridRegions",
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemMgrs.GetGridRegions",
                                                                    __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -495,7 +495,7 @@
     if (m_GridBoundary == 0)
     {
         // Proceeding without a grid boundary will cause a crash.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemMgrs.GetGridRegions",
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemMgrs.GetGridRegions",
                                                                    __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -717,7 +717,7 @@
     {
         if (m_bExceptionsOn)
         {
-            throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemMgrs.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemMgrs.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         else
         {
@@ -743,7 +743,7 @@
         {
             if (m_bExceptionsOn)
             {
-                throw new MgOutOfMemoryException(L"MgCoordinateSystemMgrs.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemMgrs.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
             }
             else
             {
@@ -758,7 +758,7 @@
     {
         if (m_bExceptionsOn)
         {
-            throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystemMgrs.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoConversionDone", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystemMgrs.ConvertFromLonLat", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoConversionDone", NULL);
         }
         else
         {
@@ -837,7 +837,7 @@
     {
         if (m_bExceptionsOn)
         {
-            throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemMgrs.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemMgrs.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         else
         {
@@ -851,7 +851,7 @@
     {
         if (m_bExceptionsOn)
         {
-            throw new MgInvalidArgumentException(L"MgCoordinateSystemMgrs.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemMgrs.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         else
         {
@@ -866,7 +866,7 @@
     {
         if (m_bExceptionsOn)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystemMgrs.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemMgrs.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         else
         {
@@ -890,7 +890,7 @@
     {
         if (m_bExceptionsOn)
         {
-            throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystemMgrs.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoConversionDone", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystemMgrs.ConvertToLonLat", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoConversionDone", NULL);
         }
         else
         {

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysProjectionInformation.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysProjectionInformation.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysProjectionInformation.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -141,7 +141,7 @@
 
     if (NULL == pNewEnum.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemProjectionInformation.GetEnumProjections", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemProjectionInformation.GetEnumProjections", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     pNewEnum->SetList(kProjections, klNumProjections);
@@ -162,7 +162,7 @@
     MG_TRY()
     if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParameterCount", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParameterCount", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     // for each possible parameter.
     int parmIdx = 0;
@@ -188,13 +188,13 @@
     MG_TRY()
     if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.IsUsingParameter", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.IsUsingParameter", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     assert((ulIndex>=1) && (ulIndex<=knCsNumParams));
     if ((ulIndex < 1) || (ulIndex > knCsNumParams))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParameterCount", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParameterCount", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     int nResult = CS_prjprm(NULL, nProjectionCode, ulIndex-1);
@@ -260,12 +260,12 @@
     MG_TRY()
     if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParameterMin", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParameterMin", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     assert((ulIndex>=1) && (ulIndex<=knCsNumParams));
     if ((ulIndex < 1) || (ulIndex > knCsNumParams))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParameterMin", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParameterMin", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Get information about the parameter
@@ -278,12 +278,12 @@
         break;
     case 0:
         //The projection does not use this parameter.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParameterMin", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParameterMin", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
         break;
     case -1:
     default:
         //Not a valid projection.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParameterMin", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParameterMin", __LINE__, __WFILE__, NULL, L"", NULL);
         break;
     }
 
@@ -299,12 +299,12 @@
     MG_TRY()
     if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParameterMax", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParameterMax", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     assert((ulIndex>=1) && (ulIndex<=knCsNumParams));
     if ((ulIndex < 1) || (ulIndex > knCsNumParams))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParameterMax", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParameterMax", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Get information about the parameter
@@ -317,12 +317,12 @@
         break;
     case 0:
         //The projection does not use this parameter.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParameterMax", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParameterMax", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
         break;
     case -1:
     default:
         //Not a valid projection.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParameterMax", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParameterMax", __LINE__, __WFILE__, NULL, L"", NULL);
         break;
     }
 
@@ -345,13 +345,13 @@
 
     if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParamDefault", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParamDefault", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     assert((ulIndex>=1) && (ulIndex<=knCsNumParams));
     if ((ulIndex < 1) || (ulIndex > knCsNumParams))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParamDefault", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParamDefault", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Get information about the parameter
@@ -364,12 +364,12 @@
         break;
     case 0:
         //The projection does not use this parameter.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParamDefault", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParamDefault", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
         break;
     case -1:
     default:
         //Not a valid projection.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParamDefault", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParamDefault", __LINE__, __WFILE__, NULL, L"", NULL);
         break;
     }
 
@@ -397,13 +397,13 @@
 
     if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParamLogicalType", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParamLogicalType", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     assert((ulIndex>=1) && (ulIndex<=knCsNumParams));
     if ((ulIndex < 1) || (ulIndex > knCsNumParams))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParamLogicalType", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParamLogicalType", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Get information about the parameter
@@ -416,12 +416,12 @@
         break;
     case 0:
         //The projection does not use this parameter.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParamLogicalType", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParamLogicalType", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
         break;
     case -1:
     default:
         //Not a valid projection.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParamLogicalType", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParamLogicalType", __LINE__, __WFILE__, NULL, L"", NULL);
         break;
     }
 
@@ -448,13 +448,13 @@
 
     if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParamFormatType", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParamFormatType", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     assert((ulIndex>=1) && (ulIndex<=knCsNumParams));
     if ((ulIndex < 1) || (ulIndex > knCsNumParams))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParamFormatType", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParamFormatType", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Get information about the parameter
@@ -467,12 +467,12 @@
         break;
     case 0:
         //The projection does not use this parameter.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParamFormatType", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParamFormatType", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
         break;
     case -1:
     default:
         //Not a valid projection.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParamFormatType", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParamFormatType", __LINE__, __WFILE__, NULL, L"", NULL);
         break;
     }
 
@@ -500,13 +500,13 @@
 
     if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParamType", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParamType", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     assert((ulIndex>=1) && (ulIndex<=knCsNumParams));
     if ((ulIndex < 1) || (ulIndex > knCsNumParams))
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParamType", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParamType", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //MENTOR_MAINTENANCE
@@ -522,12 +522,12 @@
     }
     if (mp->prj_code == cs_PRJCOD_END)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParamType", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParamType", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     nIndex = mp->prm_types[ulIndex-1];
     if (nIndex <= 0)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetParamType", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetParamType", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemMismatchException", NULL);
     }
 
     paramType = static_cast<INT32>(nIndex);
@@ -561,13 +561,13 @@
 {
     if (MgCoordinateSystemProjectionCode::Unknown == nProjectionCode)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemProjectionInformation.GetTagString", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemProjectionInformation.GetTagString", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     wchar_t* pszTag=Convert_UTF8_To_Wide(StringFromProjection(nProjectionCode));
     if (NULL == pszTag)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemProjectionInformation.GetTagString", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemProjectionInformation.GetTagString", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     STRING str(pszTag);
     delete[] pszTag;

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysTransform.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysTransform.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysTransform.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -107,7 +107,7 @@
     //Make sure we're initialized
     if (!IsInitialized())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemTransform.IsValidPoint", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemTransform.IsValidPoint", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     //Test the point
@@ -192,7 +192,7 @@
     pCoordinate = new MgCoordinateXY(dCoords [0], dCoords [1]);
     if (!pCoordinate)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.Transform")
     return pCoordinate;
@@ -255,7 +255,7 @@
     pCoordinate = new MgCoordinateXYM(dCoords [0], dCoords [1], lclM);
     if (!pCoordinate)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemTransform.TransformM", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemTransform.TransformM", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.TransformM")
@@ -317,7 +317,7 @@
     pCoordinate = new MgCoordinateXYZ(dCoords [0], dCoords [1], dCoords [2]);
     if (!pCoordinate)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.Transform")
@@ -382,7 +382,7 @@
     pCoordinate = new MgCoordinateXYZM(dCoords [0], dCoords [1], dCoords [2], lclM);
     if (!pCoordinate)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemTransform.TransformM", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemTransform.TransformM", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.TransformM")
     return pCoordinate;
@@ -509,7 +509,7 @@
     else
     {
         // What dimension is this?
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemTransform.TransformCoordinate", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemTransform.TransformCoordinate", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     if (status != TransformOk)
     {
@@ -560,7 +560,7 @@
     else
     {
         // What dimension is this?
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemTransform.Transform")
 
@@ -756,7 +756,7 @@
     //Make sure we're initialized
     if (!IsInitialized())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemTransform.GetSource", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemTransform.GetSource", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     return SAFE_ADDREF(m_pCsSource.p);
@@ -771,7 +771,7 @@
     //Make sure we're initialized
     if (!IsInitialized())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemTransform.GetTarget", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemTransform.GetTarget", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     return SAFE_ADDREF(m_pCsTarget.p);
@@ -801,7 +801,7 @@
     bValid = pSource->IsValid();
     if (!bValid)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemTransform.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemTransform.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Make sure the destination coordinate system is valid
@@ -808,7 +808,7 @@
     bValid = pTarget->IsValid();
     if (!bValid)
     {
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemTransform.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemTransform.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Build Mentor structs out of the source and destination
@@ -816,12 +816,12 @@
     bool bResult = BuildCsprmFromInterface(pSource, srcCsprm);
     if (!bResult)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemTransform.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemTransform.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     bResult = BuildCsprmFromInterface(pTarget, dstCsprm);
     if (!bResult)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemTransform.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemTransform.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Attempt to set up a datum conversion.
@@ -835,7 +835,7 @@
         //This can easily happen if, for example, it's a NADCON
         //datum shift and Mentor couldn't find the NADCON
         //data files at run time.
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemTransform.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemGeodeticTransformationSetupException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemTransform.SetSourceAndTarget", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemGeodeticTransformationSetupException", NULL);
     }
 
     //Okay, we're all set!  Uninitialize ourselves, and
@@ -879,17 +879,17 @@
 MgCoordinateSystemGeodeticTransformDef* CCoordinateSystemTransform::GetGeodeticTransformation (INT32 index)
 {
     if (index < 0 || index >= this->GetGeodeticTransformationCount())
-        throw new MgArgumentOutOfRangeException(L"GetGeodeticTransformation.GetGeodeticTransformation",__LINE__,__WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgArgumentOutOfRangeException, L"GetGeodeticTransformation.GetGeodeticTransformation",__LINE__,__WFILE__, NULL, L"", NULL);
 
     // indexparameter is valid, get a pointer to the appropriate
     // CS-MAP transformation object.
     cs_GxXform_ *xfrmPtr = m_pDtcprm->xforms [index];
     if (NULL == xfrmPtr)
-        throw new MgCoordinateSystemInitializationFailedException(L"GetGeodeticTransformation.GetGeodeticTransformation",__LINE__,__WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"GetGeodeticTransformation.GetGeodeticTransformation",__LINE__,__WFILE__, NULL, L"", NULL);
 
     cs_GeodeticTransform_* xfrmDefPtr = &xfrmPtr->gxDef;
     if (NULL == xfrmDefPtr)
-        throw new MgCoordinateSystemInitializationFailedException(L"GetGeodeticTransformation.GetGeodeticTransformation",__LINE__,__WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"GetGeodeticTransformation.GetGeodeticTransformation",__LINE__,__WFILE__, NULL, L"", NULL);
 
     // Extract the name of the transformation.
     Ptr<MgCoordinateSystemGeodeticTransformDef> catalogTransformationDef;
@@ -917,7 +917,7 @@
         //in this case, CSMAP returns a [xfrmDefPtr] but the actual (explicit) transformation definition
         //doesn't exist in the dictionaries
         if (NULL == catalogTransformationDef)
-            throw new MgCoordinateSystemLoadFailedException(L"GetGeodeticTransformation.GetGeodeticTransformation",__LINE__,__WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"GetGeodeticTransformation.GetGeodeticTransformation",__LINE__,__WFILE__, NULL, L"", NULL);
 
     MG_CATCH(L"GetGeodeticTransformation.GetGeodeticTransformation")
 
@@ -1083,7 +1083,7 @@
     assert(IsInitialized());
     if (!IsInitialized())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     dCoords [2] = 0.0;
@@ -1203,7 +1203,7 @@
     assert(IsInitialized());
     if (!IsInitialized())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     dCoords [2] = 0.0;
@@ -1328,7 +1328,7 @@
     assert(IsInitialized());
     if (!IsInitialized())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     m_nTransformStatus = TransformOk;
@@ -1455,7 +1455,7 @@
     assert(IsInitialized());
     if (!IsInitialized())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     m_nTransformStatus = TransformOk;
@@ -1520,12 +1520,12 @@
     assert(pointCount > 0);
     if (0 >= pointCount)
     {
-        throw new MgNullArgumentException(L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     assert(IsInitialized());
     if (!IsInitialized())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     // Optimization
@@ -1564,7 +1564,7 @@
     }
     if (TransformTotalFailure <= status)
     {
-        throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystemTransform.InterpretStatus", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoConversionDone", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystemTransform.InterpretStatus", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoConversionDone", NULL);
     }
     return;
 }
@@ -1581,12 +1581,12 @@
     assert(pointCount > 0);
     if (0 >= pointCount)
     {
-        throw new MgNullArgumentException(L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     assert(IsInitialized());
     if (!IsInitialized())
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemTransform.Transform", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
     }
 
     // Optimization
@@ -1625,7 +1625,7 @@
     }
     if (TransformTotalFailure <= status)
     {
-        throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystemTransform.InterpretStatus", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoConversionDone", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystemTransform.InterpretStatus", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoConversionDone", NULL);
     }
     return;
 }
@@ -1870,7 +1870,7 @@
         else
         {
             // Invalid argument value.
-            throw new MgInvalidArgumentException(L"MgCoordinateSystemTransform.PositionOfValue",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemTransform.PositionOfValue",
                                                  __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
@@ -2197,7 +2197,7 @@
     if (status == TransformTotalFailure)
     {
         m_nTransformStatus = TransformTotalFailure;
-        throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystemTransform.InterpretStatus", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoConversionDone", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystemTransform.InterpretStatus", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoConversionDone", NULL);
     }
     else if (status == TransformDatumShiftWarning)
     {
@@ -2207,7 +2207,7 @@
         }
         if (!m_bIgnoreDatumShiftWarning)
         {
-            throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystemTransform.InterpretStatus", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionWarningException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystemTransform.InterpretStatus", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionWarningException", NULL);
         }
     }
     else if (status != TransformOk)
@@ -2218,7 +2218,7 @@
         }
         if(!m_bIgnoreOutsideDomainWarning)
         {
-            throw new MgCoordinateSystemConversionFailedException(L"MgCoordinateSystemTransform.InterpretStatus", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionExtentException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemConversionFailedException, L"MgCoordinateSystemTransform.InterpretStatus", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemConversionExtentException", NULL);
         }
     }
 }

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysUnitInformation.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysUnitInformation.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysUnitInformation.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -149,7 +149,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(L""); // dummy argument
-        throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemUnitInformation.GetScale", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemUnknownUnit", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemUnitInformation.GetScale", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemUnknownUnit", NULL);
     }
 
     if (desiredUnitType != unitType)
@@ -156,7 +156,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(L""); // dummy argument
-        throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemUnitInformation.GetScale", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotLinearUnit", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemUnitInformation.GetScale", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotLinearUnit", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemUnitInformation.GetScale")
 
@@ -177,7 +177,7 @@
 
     if (NULL == pNewEnum.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemUnitInformation.GetEnumLinearUnits", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemUnitInformation.GetEnumLinearUnits", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     pNewEnum->SetList(kLinearUnits, klNumLinearUnits);
@@ -201,7 +201,7 @@
 
     if (NULL == pNewEnum.p)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemUnitInformation.GetEnumAngularUnits", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemUnitInformation.GetEnumAngularUnits", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     pNewEnum->SetList(kAngularUnits, klNumAngularUnits);
@@ -258,7 +258,7 @@
     wchar_t* pszTag = Convert_UTF8_To_Wide(StringFromUnit(unit));
     if (NULL == pszTag)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemUnitInformation.GetTagString", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemUnitInformation.GetTagString", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     STRING str(pszTag);
     delete[] pszTag;
@@ -282,7 +282,7 @@
     if (NULL == kpTag)
     {
         //Unknown unit type.
-        throw new MgInvalidArgumentException(L"MgCoordinateSystemUnitInformation.GetAbbreviation", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemUnitInformation.GetAbbreviation", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Look it up in Mentor's table

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysUtil.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysUtil.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/CoordSysUtil.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -75,7 +75,7 @@
     case kFileIsValid:
         break;
     case kFileInvalidEmptyString:
-        throw new MgInvalidArgumentException(wszMethodName, __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, wszMethodName, __LINE__, __WFILE__, NULL, L"", NULL);
         break;
     case kFileInvalidNotADir:
     case kFileInvalidIsADir:
@@ -82,7 +82,7 @@
         {
         MgStringCollection arguments;
         arguments.Add(sPathName);
-        throw new MgFileIoException(wszMethodName, __LINE__, __WFILE__, &arguments, L"MgInvalidArgumentException", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, wszMethodName, __LINE__, __WFILE__, &arguments, L"MgInvalidArgumentException", NULL);
         }
         break;
     case kFileInvalidPath:
@@ -90,16 +90,16 @@
         {
         MgStringCollection arguments;
         arguments.Add(sPathName);
-        throw new MgFileIoException(wszMethodName, __LINE__, __WFILE__, &arguments, L"MgFileNotFoundException", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, wszMethodName, __LINE__, __WFILE__, &arguments, L"MgFileNotFoundException", NULL);
         }
         break;
     case kFileInvalidCantRead:
     case kFileInvalidCantWrite:
-        throw new MgFileIoException(wszMethodName, __LINE__, __WFILE__, NULL, L"MgCoordinateSystemCatalogFileLockedException", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, wszMethodName, __LINE__, __WFILE__, NULL, L"MgCoordinateSystemCatalogFileLockedException", NULL);
         break;
     default:
         assert(0);
-        throw new MgUnclassifiedException(wszMethodName, __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgUnclassifiedException, wszMethodName, __LINE__, __WFILE__, NULL, L"", NULL);
         break;
     }
 }
@@ -697,6 +697,6 @@
     }
     return maxAvailable;
 #else // LINUX
-    throw new MgNotImplementedException(L"GetAvailableMemory", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"GetAvailableMemory", __LINE__, __WFILE__, NULL, L"", NULL);
 #endif
 }

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/MentorDictionary.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/MentorDictionary.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/MentorDictionary.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -62,7 +62,7 @@
         bWriting = true;
         break;
     default:
-        throw new MgInvalidArgumentException(L"MentorDictionary.Open", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MentorDictionary.Open", __LINE__, __WFILE__, NULL, L"", NULL);
         break;
     }
 
@@ -78,7 +78,7 @@
         switch (reason)
         {
         case kFileInvalidEmptyString:
-            throw new MgInvalidArgumentException(L"MentorDictionary.Open", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MentorDictionary.Open", __LINE__, __WFILE__, NULL, L"", NULL);
             break;
         case kFileInvalidPath:
         case kFileInvalidDoesNotExist:
@@ -86,7 +86,7 @@
             {
             MgStringCollection arguments;
             arguments.Add(kpPath);
-            throw new MgFileNotFoundException(L"MentorDictionary.Open", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgFileNotFoundException, L"MentorDictionary.Open", __LINE__, __WFILE__, &arguments, L"", NULL);
             }
             break;
         case kFileInvalidCantWrite:
@@ -93,11 +93,11 @@
             {
             MgStringCollection arguments;
             arguments.Add(kpPath);
-            throw new MgCoordinateSystemLoadFailedException(L"MentorDictionary.Open", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemDictionaryReadOnlyException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MentorDictionary.Open", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemDictionaryReadOnlyException", NULL);
             }
             break;
         default:
-            throw new MgUnclassifiedException(L"MentorDictionary.Open", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgUnclassifiedException, L"MentorDictionary.Open", __LINE__, __WFILE__, NULL, L"", NULL);
             break;
         }
         //return;
@@ -108,7 +108,7 @@
     GetFileModes(nOpenMode, szMode);
     if (NULL==(pFile=OpenDictionaryFile(kpPath, szMode, lMagic, ValidMagic)))
     {
-        throw new MgFileIoException(L"MentorDictionary.Open", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryOpenFailedException", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"MentorDictionary.Open", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryOpenFailedException", NULL);
     }
 
     //If the Mentor version is anything other than current, we're not allowed
@@ -118,7 +118,7 @@
         //Sorry, old version.  Write access not allowed.
         CS_fclose(pFile);
         pFile=NULL;
-        throw new MgInvalidArgumentException(L"MentorDictionary.Open", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryNoWriteToOldException", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MentorDictionary.Open", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryNoWriteToOldException", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MentorDictionary.Open")
@@ -159,7 +159,7 @@
         if (sDirectory.empty())
         {
             //Directory hasn't been specified yet.
-            throw new MgCoordinateSystemInitializationFailedException(kpMethodName, __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, kpMethodName, __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNotReadyException", NULL);
         }
 
         STRING sPath = sDirectory + sFileName;
@@ -179,7 +179,7 @@
         //Try to open the dictionary file
         if (!GetMagicFromDictionaryFile(sPath.c_str(), lMagic, ValidMagic))
         {
-            throw new MgFileIoException(kpMethodName, __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryOpenFailedException", NULL);
+            throw new MgException(MgExceptionCodes::MgFileIoException, kpMethodName, __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryOpenFailedException", NULL);
         }
     }//if dictionary is specified
 

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/MentorDictionary.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/MentorDictionary.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/MentorDictionary.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -94,7 +94,7 @@
             return false;
 
         //i.e. nResult < 0
-        throw new MgFileIoException(L"MentorDictionary.GetNextEntry", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"MentorDictionary.GetNextEntry", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //iterates through all entries return a vector of definitions in the same order as they've been returned by CsMap
@@ -116,7 +116,7 @@
 
             def = (T*) CS_malc(sizeof(T));
             if (NULL == def)
-                throw new MgOutOfMemoryException(L"MentorDictionary.ReadDictionaryEntries", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MentorDictionary.ReadDictionaryEntries", __LINE__, __WFILE__, NULL, L"", NULL);
 
             while (MentorDictionary::GetNextEntry(pFile, *def, nCrypt, CS_Trd))
             {
@@ -126,10 +126,7 @@
 
             return allDictEntries.release();
         }
-        catch(MgFileIoException* ioException)
-        {
-            ioException->Release();
-        }
+        MG_CATCH_AND_RELEASE_IF_TYPE(MgFileIoException)
         catch (std::bad_alloc&)
         {
         }
@@ -160,7 +157,7 @@
 
         allDefs.reset(MentorDictionary::ReadDictionaryEntries<T>(pFile, CS_Trd));
         if (NULL == allDefs.get())
-            throw new MgInvalidArgumentException(L"MentorDictionary.ReadDictionaryEntries", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MentorDictionary.ReadDictionaryEntries", __LINE__, __WFILE__, NULL, L"", NULL);
 
         MG_CATCH(L"MentorDictionary.ReadDictionaryEntries")
 
@@ -168,7 +165,7 @@
         pFile = NULL;
 
         if (!fileClosed && NULL == mgException)
-            throw new MgFileIoException(L"MentorDictionary.ReadDictionaryEntries", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
+            throw new MgException(MgExceptionCodes::MgFileIoException, L"MentorDictionary.ReadDictionaryEntries", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDictionaryCloseFailedException", NULL);
 
         MG_THROW()
 
@@ -290,7 +287,7 @@
         CHECKARGUMENTNULL(targetDictionary, L"MentorDictionary.ReadAllDefinitions");
         CHECKARGUMENTNULL(GetCode, L"MentorDictionary.ReadAllDefinitions");
         if (0 != definitions.size())
-            throw new MgInvalidArgumentException(L"MentorDictionary.ReadAllDefinitions", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MentorDictionary.ReadAllDefinitions", __LINE__, __WFILE__, NULL, L"", NULL);
 
         const UINT32 entryCount = targetDictionary->GetSize();;
         
@@ -331,7 +328,7 @@
             Ptr<MgDisposable> disposableItem = toBeFiltered->GetItem(j);
             T* mgCsItem = dynamic_cast<T*>(disposableItem.p);
             if (NULL == mgCsItem)
-                throw new MgInvalidArgumentException(L"MentorDictionary.FilterDefinitions", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MentorDictionary.FilterDefinitions", __LINE__, __WFILE__, NULL, L"", NULL);
 
             //exclude the [mgCsItem], if it's not accepted by the filter we got
             if (filters->at(j)->IsFilteredOut(mgCsItem))
@@ -366,7 +363,7 @@
         if (readStatus < 0)
         {
             _ASSERT(NULL == pDefArray);
-            throw new MgCoordinateSystemLoadFailedException(L"MgCoordinateSystemDictionary.ReadAllCoordinateSystems", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MgCoordinateSystemDictionary.ReadAllCoordinateSystems", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         const bool doPostProcess = (NULL != PostProcess);
@@ -433,7 +430,7 @@
         //Make sure the def they've given us is valid
         if (NULL != isValid && !CALL_MEMBER_FN(kpDef, isValid)())
         {
-            throw new MgInvalidArgumentException(L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         //Build a definition from the interface
@@ -441,7 +438,7 @@
         bool bResult = BuildDefFromInterface(kpDef, def);
         if (!bResult)
         {
-            throw new MgCoordinateSystemInitializationFailedException(L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         const char* keyName = key(def);
@@ -475,7 +472,7 @@
         if (bActuallyExists && !bAlreadyExists)
         {
             //It already exists, but it's not supposed to.
-            throw new MgInvalidArgumentException(L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDuplicateException", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemDuplicateException", NULL);
         }
         else if (!bActuallyExists && bAlreadyExists)
         {
@@ -483,7 +480,7 @@
             STRING message = MgUtil::MultiByteToWideChar(string(keyName));
             MgStringCollection arguments;
             arguments.Add(message);
-            throw new MgCoordinateSystemLoadFailedException(L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
 
         if (verifyNotProtected)
@@ -491,7 +488,7 @@
             //If it already exists, make sure it's not protected.
             if ((bAlreadyExists) && (IsReallyProtected(sProtect)))
             {
-                throw new MgCoordinateSystemInitializationFailedException(L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+                throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
             }
         }
 
@@ -507,7 +504,7 @@
         {
         case -1:
             //Some sort of Mentor error occurred.
-            throw new MgCoordinateSystemInitializationFailedException(L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemInternalException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemInternalException", NULL);
             return;
         case 0:
             //The new object was added to the dictionary.
@@ -526,7 +523,7 @@
                 }
                 catch (std::bad_alloc)
                 {
-                    throw new MgOutOfMemoryException(L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"", NULL);
+                    throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"", NULL);
                 }
             }    //if summary is present
             break;
@@ -571,7 +568,7 @@
                     }
                     catch (std::bad_alloc)
                     {
-                        throw new MgOutOfMemoryException(L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"", NULL);
+                        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"", NULL);
                     }
                 }    //if the key name changed case
             }    //if a summary exists
@@ -579,7 +576,7 @@
         default:
             //This should never happen.
             assert(0);
-            throw new MgUnclassifiedException(L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgUnclassifiedException, L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"", NULL);
         }    //for each possible result of the update
     }
 
@@ -612,7 +609,7 @@
         char *pName = Convert_Wide_To_UTF8(kpName);    //need to delete [] pName;
         if (NULL == pName)
         {
-            throw new MgOutOfMemoryException(L"MentorDictionary.RemoveDef", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MentorDictionary.RemoveDef", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         //Check our summary first, if present
         CSystemNameDescriptionMap::iterator iter;
@@ -628,7 +625,7 @@
                 //there.  We can return failure without the
                 //overhead of searching the disk file.
                 delete [] pName;
-                throw new MgCoordinateSystemLoadFailedException(L"MentorDictionary.RemoveDef", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
+                throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MentorDictionary.RemoveDef", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
             }
         }
         //Get def from disk file.  We need to do this even if
@@ -642,7 +639,7 @@
             STRING message = MgUtil::MultiByteToWideChar(string(pName));
             MgStringCollection arguments;
             arguments.Add(message);
-            throw new MgCoordinateSystemLoadFailedException(L"MentorDictionary.RemoveDef", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemLoadFailedException, L"MentorDictionary.RemoveDef", __LINE__, __WFILE__, &arguments, L"MgCoordinateSystemNotFoundException", NULL);
         }
 
         //Make sure it's not protected
@@ -649,7 +646,7 @@
         if (IsReallyProtected(pDef->protect))
         {
             CS_free(pDef);
-            throw new MgCoordinateSystemInitializationFailedException(L"MentorDictionary.RemoveDef", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MentorDictionary.RemoveDef", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
         }
 
         //Go ahead and attempt to delete it
@@ -667,7 +664,7 @@
         else
         {
             //Failed.
-            throw new MgCoordinateSystemInitializationFailedException(L"MentorDictionary.RemoveDef", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemInternalException", NULL);
+            throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MentorDictionary.RemoveDef", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemInternalException", NULL);
         }
     }
 

Modified: sandbox/jng/flatten_exceptions/Common/CoordinateSystem/MentorUtil.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/CoordinateSystem/MentorUtil.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/CoordinateSystem/MentorUtil.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1439,7 +1439,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(sFileName);
-        throw new MgFileIoException(/*context */ L"MentorUtil.SetDictionaryFileName", __LINE__, __WFILE__, &arguments, L"MgInvalidArgumentException", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, /*context */ L"MentorUtil.SetDictionaryFileName", __LINE__, __WFILE__, &arguments, L"MgInvalidArgumentException", NULL);
     }
 
     STRING fileNameSet;
@@ -1643,7 +1643,7 @@
 
     pString = Convert_UTF8_To_Wide(mentorString);
     if (NULL == pString) //ABA: this cannot be null, can it?
-        throw new MgOutOfMemoryException(L"MentorUtil.ReadString", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MentorUtil.ReadString", __LINE__, __WFILE__, NULL, L"", NULL);
 
     MG_CATCH(L"MentorUtil.ReadString")
 
@@ -1669,7 +1669,7 @@
     if (!IsLegalString(sSrc.c_str(), nMaxSize))
     {
         //Can't set string, caller gave us an illegal value
-        throw new MgInvalidArgumentException(L"MentorSetString", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MentorSetString", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Convert to a C++ string, for Mentor's sake
@@ -1676,7 +1676,7 @@
     pStr = Convert_Wide_To_UTF8(sSrc.c_str()); //need to delete[] pStr
     if (NULL == pStr)
     {
-        throw new MgOutOfMemoryException(L"MentorSetString", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MentorSetString", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Copy it in

Modified: sandbox/jng/flatten_exceptions/Common/Foundation/Exception/ExceptionCodes.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Foundation/Exception/ExceptionCodes.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Foundation/Exception/ExceptionCodes.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -167,4 +167,5 @@
 
 // These codes aren't in mapguide_en.res
 const STRING MgExceptionCodes::MgConfigurationLoadFailedException = L"MgConfigurationLoadFailedException";
-const STRING MgExceptionCodes::MgResourcesLoadFailedException = L"MgResourcesLoadFailedException";
\ No newline at end of file
+const STRING MgExceptionCodes::MgResourcesLoadFailedException = L"MgResourcesLoadFailedException";
+const STRING MgExceptionCodes::MgGridDensityException = L"MgGridDensityException";
\ No newline at end of file

Modified: sandbox/jng/flatten_exceptions/Common/Foundation/Exception/ExceptionCodes.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Foundation/Exception/ExceptionCodes.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Foundation/Exception/ExceptionCodes.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -159,6 +159,7 @@
     // These codes aren't in mapguide_en.res
     static const STRING MgConfigurationLoadFailedException;    ///\if INTERNAL value("MgConfigurationLoadFailedException") \endif
     static const STRING MgResourcesLoadFailedException;    ///\if INTERNAL value("MgResourcesLoadFailedException") \endif
+    static const STRING MgGridDensityException;    ///\if INTERNAL value("MgGridDensityException") \endif
 };
 
 #endif
\ No newline at end of file

Modified: sandbox/jng/flatten_exceptions/Common/Foundation/Exception/ExceptionDefs.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Foundation/Exception/ExceptionDefs.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Foundation/Exception/ExceptionDefs.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -18,6 +18,10 @@
 #ifndef MG_EXCEPTION_DEFS_H_
 #define MG_EXCEPTION_DEFS_H_
 
+// SEH macros go away!
+#if defined(GetExceptionCode)
+#undef GetExceptionCode
+#endif
 
 #define DECLARE_EXCEPTION_ABSTRACT(className) \
     virtual INT32 GetClassId(); \
@@ -91,4 +95,26 @@
     {                                                                         \
     }                                                                         \
 
+#define MG_CATCH_IF_TYPE(extype)                                              \
+    catch (MgException* ex)                                                   \
+    {                                                                         \
+        if (ex->GetExceptionCode() == MgExceptionCodes::extype)               \
+        {                                                                     \
+
+#define MG_CATCH_IF_TYPE_ELSE()                                               \
+        }                                                                     \
+        else                                                                  \
+        {                                                                     \
+            ex->Raise();                                                      \
+
+#define MG_CATCH_ENDIF_TYPE()                                                 \
+        }                                                                     \
+    }                                                                         \
+
+#define MG_CATCH_AND_RELEASE_IF_TYPE(extype) \
+    MG_CATCH_IF_TYPE(extype) \
+        ex->Release(); \
+    MG_CATCH_IF_TYPE_ELSE() \
+    MG_CATCH_ENDIF_TYPE() \
+
 #endif

Modified: sandbox/jng/flatten_exceptions/Common/Foundation/System/FoundationClassId.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Foundation/System/FoundationClassId.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Foundation/System/FoundationClassId.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -43,6 +43,9 @@
 #define Foundation_Data_Stream                            FOUNDATION_DATA_ID+8
 
 // Foundation Exception
+//
+// NOTE: Although we removed these exceptions, we are keeping the ids in to prevent these ids from being
+// accidentally used for new classes in the future
 #define Foundation_Exception_MgApplicationException                             FOUNDATION_EXCEPTION_ID+0
 #define Foundation_Exception_MgArgumentOutOfRangeException                      FOUNDATION_EXCEPTION_ID+1
 #define Foundation_Exception_MgClassNotFoundException                           FOUNDATION_EXCEPTION_ID+2

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/AgfStream.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/AgfStream.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/AgfStream.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -158,116 +158,116 @@
 //
 void MgAgfStream::GetStreamHeader(MgStreamHeader& msh)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.GetStreamHeader", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.GetStreamHeader", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 void MgAgfStream::GetOperationHeader(MgOperationPacket& operPacket)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.GetOperationHeader", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.GetOperationHeader", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 void MgAgfStream::GetOperationResponseHeader(MgOperationResponsePacket& mop)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.GetOperationResponseHeader", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.GetOperationResponseHeader", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 void MgAgfStream::GetArgumentHeader(MgArgumentPacket& map)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.GetArgumentHeader", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.GetArgumentHeader", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 void MgAgfStream::GetBinaryStreamHeader(MgBinaryStreamArgumentPacket& bsap)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.GetBinaryStreamHeader", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.GetBinaryStreamHeader", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 MgByteReader* MgAgfStream::GetStream()
 {
-    throw new MgNotImplementedException(L"MgAgfStream.GetStream", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.GetStream", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 MgStreamHelper::MgStreamStatus MgAgfStream::GetData(void* value, INT32 length)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.GetData", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.GetData", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 void MgAgfStream::GetClassId(INT32& value)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.GetClassId", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.GetClassId", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 void MgAgfStream::GetStreamEnd()
 {
-    throw new MgNotImplementedException(L"MgAgfStream.GetStreamEnd", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.GetStreamEnd", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 
 MgObject* MgAgfStream::GetObject()
 {
-    throw new MgNotImplementedException(L"MgAgfStream.GetObject", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.GetObject", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 void MgAgfStream::GetString(REFSTRING wcStr)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.GetString", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.GetString", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 MgStreamHelper::MgStreamStatus MgAgfStream::WriteStreamHeader(MgStreamHeader& msh)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.WriteStreamHeader", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.WriteStreamHeader", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 MgStreamHelper::MgStreamStatus MgAgfStream::WriteOperationHeader(MgOperationPacket& operPacket)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.WriteOperationHeader", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.WriteOperationHeader", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 MgStreamHelper::MgStreamStatus MgAgfStream::WriteBinaryStreamHeader(MgBinaryStreamArgumentPacket& bsap)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.WriteOperationHeader", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.WriteOperationHeader", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 MgStreamHelper::MgStreamStatus MgAgfStream::WriteOperationResponseHeader( MgOperationResponsePacket& mop )
 {
-    throw new MgNotImplementedException(L"MgAgfStream.WriteBinaryStreamHeader", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.WriteBinaryStreamHeader", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 MgStreamHelper::MgStreamStatus MgAgfStream::WriteArgumentHeader(MgArgumentPacket& map)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.WriteArgumentHeader", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.WriteArgumentHeader", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 MgStreamHelper::MgStreamStatus MgAgfStream::WriteString(CREFSTRING value)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.WriteString", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.WriteString", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 MgStreamHelper::MgStreamStatus MgAgfStream::WriteStream(MgByteReader* byteReader)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.WriteStream", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.WriteStream", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 MgStreamHelper::MgStreamStatus MgAgfStream::WriteClassId(INT32 value)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.WriteClassId", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.WriteClassId", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 MgStreamHelper::MgStreamStatus MgAgfStream::WriteStreamEnd()
 {
-    throw new MgNotImplementedException(L"MgAgfStream.WriteStreamEnd", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.WriteStreamEnd", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 MgStreamHelper::MgStreamStatus MgAgfStream::WriteObject(MgObject* obj)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.WriteObject", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.WriteObject", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 MgStreamHelper::MgStreamStatus MgAgfStream::WriteResponseHeader(MgPacketParser::MgECode eCode, UINT32 noOfRetValues)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.WriteResponseHeader", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.WriteResponseHeader", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 MgStreamHelper::MgStreamStatus MgAgfStream::WriteControlPacket(MgControlPacket& packet)
 {
-    throw new MgNotImplementedException(L"MgAgfStream.WriteControlPacket", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgAgfStream.WriteControlPacket", __LINE__, __WFILE__, NULL, L"", NULL);
 }

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/ArcSegment.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/ArcSegment.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/ArcSegment.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -132,7 +132,7 @@
 {
     //should not be called on geometry components
     //components are serialized by the containing geometries
-    throw new MgNotImplementedException(L"MgArcSegment.Serialize", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgArcSegment.Serialize", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 //////////////////////////////////////////////////////////////////
@@ -142,7 +142,7 @@
 {
     //should not be called on geometry components
     //components are deserialized by the containing geometries
-    throw new MgNotImplementedException(L"MgArcSegment.Deserialize", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgArcSegment.Deserialize", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 //////////////////////////////////////////////////////////////////

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/Buffer/MgBuffer.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Buffer/MgBuffer.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Buffer/MgBuffer.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -182,7 +182,7 @@
                 arguments.Add(L"2");
                 arguments.Add(buffer);
 
-                throw new MgInvalidArgumentException(L"MgBuffer.BufferGeometry",
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgBuffer.BufferGeometry",
                     __LINE__, __WFILE__, &arguments, L"MgInvalidGeometryType", NULL);
             }
         }

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/Buffer/oobject.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Buffer/oobject.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Buffer/oobject.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -55,7 +55,7 @@
 
     if (!memPtr)
     {
-        throw new MgOutOfMemoryException(L"OpsObject.AllocMem", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"OpsObject.AllocMem", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     return memPtr;
@@ -94,7 +94,7 @@
     void *newMemPtr = ::realloc(memPtr, nBytes);
     if (!newMemPtr && nBytes != 0)
     {
-        throw new MgOutOfMemoryException(L"OpsObject.ReallocMem", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"OpsObject.ReallocMem", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     return newMemPtr;
 

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/CoordinateSystem/CoordinateSystemFactory.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/CoordinateSystem/CoordinateSystemFactory.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/CoordinateSystem/CoordinateSystemFactory.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -79,7 +79,7 @@
 
     if (!sm_pCatalog)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemFactory.MgCoordinateSystemFactory", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFactory.MgCoordinateSystemFactory", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.MgCoordinateSystemFactory")
@@ -106,7 +106,7 @@
 
     if (NULL == sm_pCatalog)
     {
-        throw new MgCoordinateSystemInitializationFailedException(
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, 
             L"MgCoordinateSystemFactory.Create",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
@@ -144,7 +144,7 @@
 
     if (NULL == sm_pCatalog)
     {
-        throw new MgCoordinateSystemInitializationFailedException(
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, 
             L"MgCoordinateSystemFactory.CreateFromCode",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
@@ -201,7 +201,7 @@
 
     if (!sm_pCatalog)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.GetCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.GetCatalog", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.GetCatalog")
 
@@ -216,7 +216,7 @@
     pNew=new CCoordinateSystemTransform(pSource, pTarget);
     if (NULL == pNew)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemFactory.GetTransform", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFactory.GetTransform", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.GetTransform")
 
@@ -243,12 +243,12 @@
 
     if (!sm_pCatalog)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.ConvertWktToCoordinateSystemCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.ConvertWktToCoordinateSystemCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     Ptr<MgCoordinateSystemFormatConverter> pConverter=sm_pCatalog->GetFormatConverter();
     if (!pConverter)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.ConvertWktToCoordinateSystemCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.ConvertWktToCoordinateSystemCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     code=pConverter->WktToCode(MgCoordinateSystemWktFlavor::Unknown, wkt, MgCoordinateSystemCodeFormat::Mentor);
 
@@ -276,12 +276,12 @@
 
     if (!sm_pCatalog)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.ConvertCoordinateSystemCodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.ConvertCoordinateSystemCodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     Ptr<MgCoordinateSystemFormatConverter> pConverter=sm_pCatalog->GetFormatConverter();
     if (!pConverter)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.ConvertCoordinateSystemCodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.ConvertCoordinateSystemCodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     // Check to see if this is an EPSG code. ie: "EPSG:4326"
@@ -319,27 +319,27 @@
     categoryNames = new MgStringCollection();
     if (!categoryNames)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemFactory.EnumerateCategories", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFactory.EnumerateCategories", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     if (!sm_pCatalog)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.ToString", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.ToString", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     Ptr<MgCoordinateSystemCategoryDictionary> pCtDict=sm_pCatalog->GetCategoryDictionary();
     if (!pCtDict)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.EnumerateCategories", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoCategoryDictionaryException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.EnumerateCategories", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoCategoryDictionaryException", NULL);
     }
     Ptr<MgCoordinateSystemEnum> pEnum=pCtDict->GetEnum();
     if (!pEnum)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemFactory.EnumerateCategories", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFactory.EnumerateCategories", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     UINT32 nNbCategories=pCtDict->GetSize();
     categoryNames=pEnum->NextName(nNbCategories);
     if (categoryNames->GetCount()!=nNbCategories)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.EnumerateCategories", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.EnumerateCategories", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.EnumerateCategories")
@@ -367,26 +367,26 @@
     pCoordinateSystems = new MgBatchPropertyCollection();
     if (!pCoordinateSystems)
     {
-        throw new MgOutOfMemoryException(L"MgCoordinateSystemFactory.EnumerateCoordinateSystems", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFactory.EnumerateCoordinateSystems", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     if (!sm_pCatalog)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.EnumerateCoordinateSystems", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.EnumerateCoordinateSystems", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     Ptr<MgCoordinateSystemCategoryDictionary> pCtDict=sm_pCatalog->GetCategoryDictionary();
     if (!pCtDict)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.EnumerateCoordinateSystems", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoCategoryDictionaryException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.EnumerateCoordinateSystems", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoCategoryDictionaryException", NULL);
     }
     Ptr<MgCoordinateSystemCategory> pCategory=pCtDict->GetCategory(category);
     if (!pCategory)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.EnumerateCoordinateSystems", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoCategoryInDictionaryException", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.EnumerateCoordinateSystems", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemNoCategoryInDictionaryException", NULL);
     }
     Ptr<MgCoordinateSystemEnum> pEnum=pCategory->GetEnum();
     if (!pEnum)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.EnumerateCoordinateSystems", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.EnumerateCoordinateSystems", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     for ( ; ; )
@@ -463,12 +463,12 @@
 
     if (!sm_pCatalog)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.ConvertEpsgCodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.ConvertEpsgCodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     Ptr<MgCoordinateSystemFormatConverter> pConverter=sm_pCatalog->GetFormatConverter();
     if (!pConverter)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.ConvertEpsgCodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.ConvertEpsgCodeToWkt", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     wchar_t wszEpsg[255];
     #ifdef _WIN32
@@ -502,12 +502,12 @@
 
     if (!sm_pCatalog)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.ConvertWktToEpsgCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.ConvertWktToEpsgCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     Ptr<MgCoordinateSystemFormatConverter> pConverter=sm_pCatalog->GetFormatConverter();
     if (!pConverter)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.ConvertWktToEpsgCode", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.ConvertWktToEpsgCode", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     STRING strEpsgCode=pConverter->WktToCode(MgCoordinateSystemWktFlavor::Unknown, wkt, MgCoordinateSystemCodeFormat::Epsg);
     nEpsg = (INT32)wcstol(strEpsgCode.c_str(), NULL, 10);
@@ -536,13 +536,13 @@
 
     if (!sm_pCatalog)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.IsValid", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.IsValid", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     Ptr<MgCoordinateSystemFormatConverter> pConverter=sm_pCatalog->GetFormatConverter();
     if (!pConverter)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemFactory.IsValid", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgCoordinateSystemInitializationFailedException, L"MgCoordinateSystemFactory.IsValid", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     try
@@ -592,7 +592,7 @@
             // Check the consistency of all these parameters.
             if (!gridSpecification->IsConsistent ())
             {
-                throw new MgInvalidArgumentException(L"MgCoordinateSystemFactory.GridSpecification", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCoordinateSystemFactory.GridSpecification", __LINE__, __WFILE__, NULL, L"", NULL);
             }
         }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemFactory.GridSpecification")
@@ -666,7 +666,7 @@
     {
         if (bSetExceptionsOn)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystemFactory.GetMgrs", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFactory.GetMgrs", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         else
         {
@@ -695,7 +695,7 @@
     {
         if (bSetExceptionsOn)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystemFactory.GetMgrsEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFactory.GetMgrsEllipsoid", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         else
         {
@@ -724,7 +724,7 @@
     {
         if (bSetExceptionsOn)
         {
-            throw new MgOutOfMemoryException(L"MgCoordinateSystemFactory.GetMgrsDatum", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFactory.GetMgrsDatum", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         else
         {
@@ -768,7 +768,7 @@
         {
             if (bSetExceptionsOn)
             {
-                throw new MgOutOfMemoryException(L"MgCoordinateSystemFactory.GetMgrsDatum", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFactory.GetMgrsDatum", __LINE__, __WFILE__, NULL, L"", NULL);
             }
             else
             {
@@ -818,7 +818,7 @@
         {
             if (bSetExceptionsOn)
             {
-                throw new MgOutOfMemoryException(L"MgCoordinateSystemFactory.GetMgrsDatum", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgCoordinateSystemFactory.GetMgrsDatum", __LINE__, __WFILE__, NULL, L"", NULL);
             }
             else
             {

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/CurvePolygon.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/CurvePolygon.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/CurvePolygon.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -60,7 +60,7 @@
 MgCurveRing* MgCurvePolygon::GetInteriorRing(INT32 index)
 {
     if (m_innerRings == NULL)
-        throw new MgArgumentOutOfRangeException(L"MgCurvePolygon.GetInteriorRing", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgArgumentOutOfRangeException, L"MgCurvePolygon.GetInteriorRing", __LINE__, __WFILE__, NULL, L"", NULL);
 
     return m_innerRings->GetItem(index);
 }

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/CurveRing.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/CurveRing.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/CurveRing.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -147,7 +147,7 @@
 {
     //should not be called on geometry components
     //components are serialized by the containing geometries
-    throw new MgNotImplementedException(L"MgCurveRing.Serialize", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgCurveRing.Serialize", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 //////////////////////////////////////////////////////////////////
@@ -157,7 +157,7 @@
 {
     //should not be called on geometry components
     //components are deserialized by the containing geometries
-    throw new MgNotImplementedException(L"MgCurveRing.Deserialize", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgCurveRing.Deserialize", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 ///////////////////////////////////////////////////////////////////////////

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/CurveString.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/CurveString.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/CurveString.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -32,7 +32,7 @@
         arguments.Add(L"1");
         arguments.Add(L"0");
 
-        throw new MgInvalidArgumentException(L"MgCurveString.MgCurveString",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgCurveString.MgCurveString",
             __LINE__, __WFILE__, &arguments, L"MgGeometryEmpty", NULL);
     }
 

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/Envelope.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Envelope.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Envelope.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -59,7 +59,7 @@
         arguments.Add(L"2");
         arguments.Add(buffer);
 
-        throw new MgInvalidArgumentException(L"MgEnvelope.MgEnvelope",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgEnvelope.MgEnvelope",
             __LINE__, __WFILE__, &arguments, L"MgCoordinateDimensionDifferent", NULL);
     }
 
@@ -78,7 +78,7 @@
             arguments.Add(L"2");
             arguments.Add(buffer);
 
-            throw new MgInvalidArgumentException(L"MgEnvelope.MgEnvelope",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgEnvelope.MgEnvelope",
                 __LINE__, __WFILE__, &arguments, L"MgInvalidEnvelopeCoordinates", NULL);
         }
 
@@ -100,7 +100,7 @@
             arguments.Add(L"2");
             arguments.Add(buffer);
 
-            throw new MgInvalidArgumentException(L"MgEnvelope.MgEnvelope",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgEnvelope.MgEnvelope",
                 __LINE__, __WFILE__, &arguments, L"MgInvalidEnvelopeCoordinates", NULL);
         }
 
@@ -139,7 +139,7 @@
         arguments.Add(L"2");
         arguments.Add(buffer);
 
-        throw new MgInvalidArgumentException(L"MgEnvelope.MgEnvelope",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgEnvelope.MgEnvelope",
             __LINE__, __WFILE__, &arguments, L"MgInvalidEnvelopeCoordinates", NULL);
     }
 
@@ -155,7 +155,7 @@
         arguments.Add(L"2");
         arguments.Add(buffer);
 
-        throw new MgInvalidArgumentException(L"MgEnvelope.MgEnvelope",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgEnvelope.MgEnvelope",
             __LINE__, __WFILE__, &arguments, L"MgInvalidEnvelopeCoordinates", NULL);
     }
 
@@ -273,11 +273,11 @@
 
         Ptr<MgCoordinateXY> ll = new MgCoordinateXY(llx, lly);
         if(ll == NULL)
-            throw new MgOutOfMemoryException(L"MgEnvelope.ExpandToInclude", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgEnvelope.ExpandToInclude", __LINE__, __WFILE__, NULL, L"", NULL);
 
         Ptr<MgCoordinateXY> ur = new MgCoordinateXY(urx, ury);
         if(ur == NULL)
-            throw new MgOutOfMemoryException(L"MgEnvelope.ExpandToInclude", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgEnvelope.ExpandToInclude", __LINE__, __WFILE__, NULL, L"", NULL);
 
         m_lowerLeft  = SAFE_ADDREF((MgCoordinate*)ll);
         m_upperRight = SAFE_ADDREF((MgCoordinate*)ur);
@@ -443,11 +443,11 @@
 
         Ptr<MgCoordinateXY> ll = new MgCoordinateXY(minX, minY);
         if (ll == NULL)
-            throw new MgOutOfMemoryException(L"MgEnvelope.Grow", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgEnvelope.Grow", __LINE__, __WFILE__, NULL, L"", NULL);
 
         Ptr<MgCoordinateXY> ur = new MgCoordinateXY(maxX, maxY);
         if (ur == NULL)
-            throw new MgOutOfMemoryException(L"MgEnvelope.Grow", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgEnvelope.Grow", __LINE__, __WFILE__, NULL, L"", NULL);
 
         m_lowerLeft  = SAFE_ADDREF((MgCoordinate*)ll);
         m_upperRight = SAFE_ADDREF((MgCoordinate*)ur);

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemComputationFailedException.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemComputationFailedException.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemComputationFailedException.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,40 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#include "Foundation.h"
-
-IMPLEMENT_EXCEPTION_DEFAULTS(MgCoordinateSystemComputationFailedException, MgApplicationException)
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Construct a MgCoordinateSystemComputationFailedException object.
-///
-MgCoordinateSystemComputationFailedException::MgCoordinateSystemComputationFailedException(CREFSTRING methodName,
-    INT32 lineNumber, CREFSTRING fileName, MgStringCollection* whatArguments,
-    CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw() :
-    MgApplicationException(methodName, lineNumber, fileName,
-        whatArguments, whyMessageId, whyArguments)
-{
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Destruct the object.
-///
-MgCoordinateSystemComputationFailedException::~MgCoordinateSystemComputationFailedException() throw()
-{
-}

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemComputationFailedException.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemComputationFailedException.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemComputationFailedException.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,69 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-/// \ingroup Exceptions_Module
-
-#ifndef MG_COORDINATE_SYSTEM_COMPUTATION_FAILED_EXCEPTION_H_
-#define MG_COORDINATE_SYSTEM_COMPUTATION_FAILED_EXCEPTION_H_
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Thrown when a coordinate system computation fails.
-///
-class MG_GEOMETRY_API MgCoordinateSystemComputationFailedException : public MgApplicationException
-{
-    DECLARE_CLASSNAME(MgCoordinateSystemComputationFailedException)
-
-EXTERNAL_API:
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Construct a MgCoordinateSystemComputationFailedException object.
-    ///
-    /// \param methodName
-    /// Name of the method where the exception occurred.
-    /// \param lineNumber
-    /// Line number where the exception occurred.
-    /// \param fileName
-    /// File name where the exception occurred.
-    /// \param whatArguments
-    /// Collection of arguments used to format the message that describes what the exception is.
-    /// \param whyMessageId
-    /// ID of the message that describes why the exception occurs.
-    /// \param whyArguments
-    /// Collection of arguments used to format the message that describes why the exception occurs.
-    ///
-    MgCoordinateSystemComputationFailedException(CREFSTRING methodName, INT32 lineNumber,
-        CREFSTRING fileName, MgStringCollection* whatArguments,
-        CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw();
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Destructor for a MgCoordinateSystemConversionFailedException object.
-    ///
-    virtual ~MgCoordinateSystemComputationFailedException() throw();
-
-INTERNAL_API:
-
-    DECLARE_EXCEPTION_DEFAULTS(MgCoordinateSystemComputationFailedException)
-
-CLASS_ID:
-
-    static const INT32 m_cls_id = Geometry_Exception_MgCoordinateSystemComputationFailedException;
-};
-
-#endif

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemConversionFailedException.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemConversionFailedException.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemConversionFailedException.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,40 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#include "Foundation.h"
-
-IMPLEMENT_EXCEPTION_DEFAULTS(MgCoordinateSystemConversionFailedException, MgApplicationException)
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Construct a MgCoordinateSystemConversionFailedException object.
-///
-MgCoordinateSystemConversionFailedException::MgCoordinateSystemConversionFailedException(CREFSTRING methodName,
-    INT32 lineNumber, CREFSTRING fileName, MgStringCollection* whatArguments,
-    CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw() :
-    MgApplicationException(methodName, lineNumber, fileName,
-        whatArguments, whyMessageId, whyArguments)
-{
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Destruct the object.
-///
-MgCoordinateSystemConversionFailedException::~MgCoordinateSystemConversionFailedException() throw()
-{
-}

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemConversionFailedException.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemConversionFailedException.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemConversionFailedException.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,69 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-/// \ingroup Exceptions_Module
-
-#ifndef MG_COORDINATE_SYSTEM_CONVERSION_FAILED_EXCEPTION_H_
-#define MG_COORDINATE_SYSTEM_CONVERSION_FAILED_EXCEPTION_H_
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Thrown when a coordinate system conversion fails.
-///
-class MG_GEOMETRY_API MgCoordinateSystemConversionFailedException : public MgApplicationException
-{
-    DECLARE_CLASSNAME(MgCoordinateSystemConversionFailedException)
-
-EXTERNAL_API:
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Construct a MgCoordinateSystemConversionFailedException object.
-    ///
-    /// \param methodName
-    /// Name of the method where the exception occurred.
-    /// \param lineNumber
-    /// Line number where the exception occurred.
-    /// \param fileName
-    /// File name where the exception occurred.
-    /// \param whatArguments
-    /// Collection of arguments used to format the message that describes what the exception is.
-    /// \param whyMessageId
-    /// ID of the message that describes why the exception occurs.
-    /// \param whyArguments
-    /// Collection of arguments used to format the message that describes why the exception occurs.
-    ///
-    MgCoordinateSystemConversionFailedException(CREFSTRING methodName, INT32 lineNumber,
-        CREFSTRING fileName, MgStringCollection* whatArguments,
-        CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw();
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Destructor for a MgCoordinateSystemConversionFailedException object.
-    ///
-    virtual ~MgCoordinateSystemConversionFailedException() throw();
-
-INTERNAL_API:
-
-    DECLARE_EXCEPTION_DEFAULTS(MgCoordinateSystemConversionFailedException)
-
-CLASS_ID:
-
-    static const INT32 m_cls_id = Geometry_Exception_MgCoordinateSystemConversionFailedException;
-};
-
-#endif

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemInitializationFailedException.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemInitializationFailedException.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemInitializationFailedException.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,40 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#include "Foundation.h"
-
-IMPLEMENT_EXCEPTION_DEFAULTS(MgCoordinateSystemInitializationFailedException, MgApplicationException)
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Construct a MgCoordinateSystemInitializationFailedException object.
-///
-MgCoordinateSystemInitializationFailedException::MgCoordinateSystemInitializationFailedException(CREFSTRING methodName,
-    INT32 lineNumber, CREFSTRING fileName, MgStringCollection* whatArguments,
-    CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw() :
-    MgApplicationException(methodName, lineNumber, fileName,
-        whatArguments, whyMessageId, whyArguments)
-{
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Destruct the object.
-///
-MgCoordinateSystemInitializationFailedException::~MgCoordinateSystemInitializationFailedException() throw()
-{
-}

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemInitializationFailedException.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemInitializationFailedException.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemInitializationFailedException.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,68 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#ifndef MG_COORDINATE_SYSTEM_INITIALIZATION_FAILED_EXCEPTION_H_
-#define MG_COORDINATE_SYSTEM_INITIALIZATION_FAILED_EXCEPTION_H_
-
-/// \ingroup Exceptions_Module
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// The exception is thrown when the coordinate system initialization fails.
-///
-class MG_GEOMETRY_API MgCoordinateSystemInitializationFailedException : public MgApplicationException
-{
-    DECLARE_CLASSNAME(MgCoordinateSystemInitializationFailedException)
-
-EXTERNAL_API:
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Construct a MgCoordinateSystemInitializationFailedException object.
-    ///
-    /// \param methodName
-    /// Name of the method where the exception occurred.
-    /// \param lineNumber
-    /// Line number where the exception occurred.
-    /// \param fileName
-    /// File name where the exception occurred.
-    /// \param whatArguments
-    /// Collection of arguments used to format the message that describes what the exception is.
-    /// \param whyMessageId
-    /// ID of the message that describes why the exception occurs.
-    /// \param whyArguments
-    /// Collection of arguments used to format the message that describes why the exception occurs.
-    ///
-    MgCoordinateSystemInitializationFailedException(CREFSTRING methodName, INT32 lineNumber,
-        CREFSTRING fileName, MgStringCollection* whatArguments,
-        CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw();
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Destructor for a MgCoordinateSystemInitializationFailedException object.
-    ///
-    virtual ~MgCoordinateSystemInitializationFailedException() throw();
-
-INTERNAL_API:
-
-    DECLARE_EXCEPTION_DEFAULTS(MgCoordinateSystemInitializationFailedException)
-
-CLASS_ID:
-
-    static const INT32 m_cls_id = Geometry_Exception_MgCoordinateSystemInitializationFailedException;
-};
-
-#endif

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemLoadFailedException.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemLoadFailedException.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemLoadFailedException.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,40 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#include "Foundation.h"
-
-IMPLEMENT_EXCEPTION_DEFAULTS(MgCoordinateSystemLoadFailedException, MgApplicationException)
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Construct a MgCoordinateSystemLoadFailedException object.
-///
-MgCoordinateSystemLoadFailedException::MgCoordinateSystemLoadFailedException(CREFSTRING methodName,
-    INT32 lineNumber, CREFSTRING fileName, MgStringCollection* whatArguments,
-    CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw() :
-    MgApplicationException(methodName, lineNumber, fileName,
-        whatArguments, whyMessageId, whyArguments)
-{
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Destruct the object.
-///
-MgCoordinateSystemLoadFailedException::~MgCoordinateSystemLoadFailedException() throw()
-{
-}

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemLoadFailedException.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemLoadFailedException.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemLoadFailedException.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,68 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#ifndef MG_COORDINATE_SYSTEM_LOAD_FAILED_EXCEPTION_H_
-#define MG_COORDINATE_SYSTEM_LOAD_FAILED_EXCEPTION_H_
-
-/// \ingroup Exceptions_Module
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// The exception is thrown when the coordinate system load fails.
-///
-class MG_GEOMETRY_API MgCoordinateSystemLoadFailedException : public MgApplicationException
-{
-    DECLARE_CLASSNAME(MgCoordinateSystemLoadFailedException)
-
-EXTERNAL_API:
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Construct a MgCoordinateSystemLoadFailedException object.
-    ///
-    /// \param methodName
-    /// Name of the method where the exception occurred.
-    /// \param lineNumber
-    /// Line number where the exception occurred.
-    /// \param fileName
-    /// File name where the exception occurred.
-    /// \param whatArguments
-    /// Collection of arguments used to format the message that describes what the exception is.
-    /// \param whyMessageId
-    /// ID of the message that describes why the exception occurs.
-    /// \param whyArguments
-    /// Collection of arguments used to format the message that describes why the exception occurs.
-    ///
-    MgCoordinateSystemLoadFailedException(CREFSTRING methodName, INT32 lineNumber,
-        CREFSTRING fileName, MgStringCollection* whatArguments,
-        CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw();
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Destructor for a MgCoordinateSystemLoadFailedException object.
-    ///
-    virtual ~MgCoordinateSystemLoadFailedException() throw();
-
-INTERNAL_API:
-
-    DECLARE_EXCEPTION_DEFAULTS(MgCoordinateSystemLoadFailedException)
-
-CLASS_ID:
-
-    static const INT32 m_cls_id = Geometry_Exception_MgCoordinateSystemLoadFailedException;
-};
-
-#endif

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemMeasureFailedException.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemMeasureFailedException.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemMeasureFailedException.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,40 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#include "Foundation.h"
-
-IMPLEMENT_EXCEPTION_DEFAULTS(MgCoordinateSystemMeasureFailedException, MgApplicationException)
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Construct a MgCoordinateSystemMeasureFailedException object.
-///
-MgCoordinateSystemMeasureFailedException::MgCoordinateSystemMeasureFailedException(CREFSTRING methodName,
-    INT32 lineNumber, CREFSTRING fileName, MgStringCollection* whatArguments,
-    CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw() :
-    MgApplicationException(methodName, lineNumber, fileName,
-        whatArguments, whyMessageId, whyArguments)
-{
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Destruct the object.
-///
-MgCoordinateSystemMeasureFailedException::~MgCoordinateSystemMeasureFailedException() throw()
-{
-}

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemMeasureFailedException.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemMeasureFailedException.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemMeasureFailedException.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,69 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-/// \ingroup Exceptions_Module
-
-#ifndef MG_COORDINATE_SYSTEM_MEASURE_FAILED_EXCEPTION_H_
-#define MG_COORDINATE_SYSTEM_MEASURE_FAILED_EXCEPTION_H_
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Thrown when a coordinate system measurement fails.
-///
-class MG_GEOMETRY_API MgCoordinateSystemMeasureFailedException : public MgApplicationException
-{
-    DECLARE_CLASSNAME(MgCoordinateSystemMeasureFailedException)
-
-EXTERNAL_API:
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Construct a MgCoordinateSystemMeasureFailedException object.
-    ///
-    /// \param methodName
-    /// Name of the method where the exception occurred.
-    /// \param lineNumber
-    /// Line number where the exception occurred.
-    /// \param fileName
-    /// File name where the exception occurred.
-    /// \param whatArguments
-    /// Collection of arguments used to format the message that describes what the exception is.
-    /// \param whyMessageId
-    /// ID of the message that describes why the exception occurs.
-    /// \param whyArguments
-    /// Collection of arguments used to format the message that describes why the exception occurs.
-    ///
-    MgCoordinateSystemMeasureFailedException(CREFSTRING methodName, INT32 lineNumber,
-        CREFSTRING fileName, MgStringCollection* whatArguments,
-        CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw();
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Destructor for a MgCoordinateSystemConversionFailedException object.
-    ///
-    virtual ~MgCoordinateSystemMeasureFailedException() throw();
-
-INTERNAL_API:
-
-    DECLARE_EXCEPTION_DEFAULTS(MgCoordinateSystemMeasureFailedException)
-
-CLASS_ID:
-
-    static const INT32 m_cls_id = Geometry_Exception_MgCoordinateSystemMeasureFailedException;
-};
-
-#endif

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemTransformFailedException.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemTransformFailedException.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemTransformFailedException.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,40 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#include "Foundation.h"
-
-IMPLEMENT_EXCEPTION_DEFAULTS(MgCoordinateSystemTransformFailedException, MgApplicationException)
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Construct a MgCoordinateSystemTransformFailedException object.
-///
-MgCoordinateSystemTransformFailedException::MgCoordinateSystemTransformFailedException(CREFSTRING methodName,
-    INT32 lineNumber, CREFSTRING fileName, MgStringCollection* whatArguments,
-    CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw() :
-    MgApplicationException(methodName, lineNumber, fileName,
-        whatArguments, whyMessageId, whyArguments)
-{
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Destruct the object.
-///
-MgCoordinateSystemTransformFailedException::~MgCoordinateSystemTransformFailedException() throw()
-{
-}

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemTransformFailedException.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemTransformFailedException.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/CoordinateSystemTransformFailedException.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,69 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-/// \ingroup Exceptions_Module
-
-#ifndef MG_COORDINATE_SYSTEM_TRANSFORM_FAILED_EXCEPTION_H_
-#define MG_COORDINATE_SYSTEM_TRANSFORM_FAILED_EXCEPTION_H_
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Thrown when a coordinate system transform fails.
-///
-class MG_GEOMETRY_API MgCoordinateSystemTransformFailedException : public MgApplicationException
-{
-    DECLARE_CLASSNAME(MgCoordinateSystemTransformFailedException)
-
-EXTERNAL_API:
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Construct a MgCoordinateSystemTransformFailedException object.
-    ///
-    /// \param methodName
-    /// Name of the method where the exception occurred.
-    /// \param lineNumber
-    /// Line number where the exception occurred.
-    /// \param fileName
-    /// File name where the exception occurred.
-    /// \param whatArguments
-    /// Collection of arguments used to format the message that describes what the exception is.
-    /// \param whyMessageId
-    /// ID of the message that describes why the exception occurs.
-    /// \param whyArguments
-    /// Collection of arguments used to format the message that describes why the exception occurs.
-    ///
-    MgCoordinateSystemTransformFailedException(CREFSTRING methodName, INT32 lineNumber,
-        CREFSTRING fileName, MgStringCollection* whatArguments,
-        CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw();
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Destructor for a MgCoordinateSystemTransformFailedException object.
-    ///
-    virtual ~MgCoordinateSystemTransformFailedException() throw();
-
-INTERNAL_API:
-
-    DECLARE_EXCEPTION_DEFAULTS(MgCoordinateSystemTransformFailedException)
-
-CLASS_ID:
-
-    static const INT32 m_cls_id = Geometry_Exception_MgCoordinateSystemTransformFailedException;
-};
-
-#endif

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/GeometryException.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/GeometryException.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/GeometryException.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,40 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#include "Foundation.h"
-
-IMPLEMENT_EXCEPTION_DEFAULTS(MgGeometryException, MgThirdPartyException)
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Construct a MgGeometryException object.
-///
-MgGeometryException::MgGeometryException(CREFSTRING methodName,
-    INT32 lineNumber, CREFSTRING fileName, MgStringCollection* whatArguments,
-    CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw() :
-    MgThirdPartyException(methodName, lineNumber, fileName,
-        whatArguments, whyMessageId, whyArguments)
-{
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Destruct the object.
-///
-MgGeometryException::~MgGeometryException() throw()
-{
-}

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/GeometryException.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/GeometryException.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/GeometryException.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,69 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#ifndef MG_GEOMETRY_EXCEPTION_H_
-#define MG_GEOMETRY_EXCEPTION_H_
-
-/// \ingroup Exceptions_Module
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Thrown when an error occurs calculating geometry.
-///
-class MG_GEOMETRY_API MgGeometryException : public MgThirdPartyException
-{
-    DECLARE_CLASSNAME(MgGeometryException)
-
-EXTERNAL_API:
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Construct a MgGeometryException object.
-    ///
-    /// \param methodName
-    /// Name of the method where the exception occurred.
-    /// \param lineNumber
-    /// Line number where the exception occurred.
-    /// \param fileName
-    /// File name where the exception occurred.
-    /// \param whatArguments
-    /// Collection of arguments used to format the message that describes what the exception is.
-    /// \param whyMessageId
-    /// ID of the message that describes why the exception occurs.
-    /// \param whyArguments
-    /// Collection of arguments used to format the message that describes why the exception occurs.
-    ///
-    MgGeometryException(CREFSTRING methodName, INT32 lineNumber,
-        CREFSTRING fileName, MgStringCollection* whatArguments,
-        CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw();
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Destructor for a MgGeometryException object.
-    ///
-    virtual ~MgGeometryException() throw();
-
-INTERNAL_API:
-
-    DECLARE_EXCEPTION_DEFAULTS(MgGeometryException)
-
-CLASS_ID:
-
-    static const INT32 m_cls_id = Geometry_Exception_MgGeometryException;
-};
-
-#endif

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemException.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemException.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemException.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,40 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#include "Foundation.h"
-
-IMPLEMENT_EXCEPTION_DEFAULTS(MgInvalidCoordinateSystemException, MgApplicationException)
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Construct a MgInvalidCoordinateSystemException object.
-///
-MgInvalidCoordinateSystemException::MgInvalidCoordinateSystemException(CREFSTRING methodName,
-    INT32 lineNumber, CREFSTRING fileName, MgStringCollection* whatArguments,
-    CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw() :
-    MgApplicationException(methodName, lineNumber, fileName,
-        whatArguments, whyMessageId, whyArguments)
-{
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Destruct the object.
-///
-MgInvalidCoordinateSystemException::~MgInvalidCoordinateSystemException() throw()
-{
-}

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemException.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemException.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemException.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,69 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#ifndef MG_INVALID_COORDINATE_SYSTEM_EXCEPTION_H_
-#define MG_INVALID_COORDINATE_SYSTEM_EXCEPTION_H_
-
-/// \ingroup Exceptions_Module
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Thrown when the Coordinate System API encounters a problem.
-///
-class MG_GEOMETRY_API MgInvalidCoordinateSystemException : public MgApplicationException
-{
-    DECLARE_CLASSNAME(MgInvalidCoordinateSystemException)
-
-EXTERNAL_API:
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Construct a MgInvalidCoordinateSystemException object.
-    ///
-    /// \param methodName
-    /// Name of the method where the exception occurred.
-    /// \param lineNumber
-    /// Line number where the exception occurred.
-    /// \param fileName
-    /// File name where the exception occurred.
-    /// \param whatArguments
-    /// Collection of arguments used to format the message that describes what the exception is.
-    /// \param whyMessageId
-    /// ID of the message that describes why the exception occurs.
-    /// \param whyArguments
-    /// Collection of arguments used to format the message that describes why the exception occurs.
-    ///
-    MgInvalidCoordinateSystemException(CREFSTRING methodName, INT32 lineNumber,
-        CREFSTRING fileName, MgStringCollection* whatArguments,
-        CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw();
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Destructor for a MgInvalidCoordinateSystemException object.
-    ///
-    virtual ~MgInvalidCoordinateSystemException() throw();
-
-INTERNAL_API:
-
-    DECLARE_EXCEPTION_DEFAULTS(MgInvalidCoordinateSystemException)
-
-CLASS_ID:
-
-    static const INT32 m_cls_id = Geometry_Exception_MgInvalidCoordinateSystemException;
-};
-
-#endif

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemTypeException.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemTypeException.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemTypeException.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,40 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#include "Foundation.h"
-
-IMPLEMENT_EXCEPTION_DEFAULTS(MgInvalidCoordinateSystemTypeException, MgApplicationException)
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Construct a MgInvalidCoordinateSystemTypeException object.
-///
-MgInvalidCoordinateSystemTypeException::MgInvalidCoordinateSystemTypeException(CREFSTRING methodName,
-    INT32 lineNumber, CREFSTRING fileName, MgStringCollection* whatArguments,
-    CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw() :
-    MgApplicationException(methodName, lineNumber, fileName,
-        whatArguments, whyMessageId, whyArguments)
-{
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Destruct the object.
-///
-MgInvalidCoordinateSystemTypeException::~MgInvalidCoordinateSystemTypeException() throw()
-{
-}

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemTypeException.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemTypeException.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemTypeException.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,69 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-/// \ingroup Exceptions_Module
-
-#ifndef MG_INVALID_COORDINATE_SYSTEM_TYPE_EXCEPTION_H_
-#define MG_INVALID_COORDINATE_SYSTEM_TYPE_EXCEPTION_H_
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Thrown when the coordinate system type is invalid.
-///
-class MG_GEOMETRY_API MgInvalidCoordinateSystemTypeException : public MgApplicationException
-{
-    DECLARE_CLASSNAME(MgInvalidCoordinateSystemTypeException)
-
-EXTERNAL_API:
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Construct a MgInvalidCoordinateSystemTypeException object.
-    ///
-    /// \param methodName
-    /// Name of the method where the exception occurred.
-    /// \param lineNumber
-    /// Line number where the exception occurred.
-    /// \param fileName
-    /// File name where the exception occurred.
-    /// \param whatArguments
-    /// Collection of arguments used to format the message that describes what the exception is.
-    /// \param whyMessageId
-    /// ID of the message that describes why the exception occurs.
-    /// \param whyArguments
-    /// Collection of arguments used to format the message that describes why the exception occurs.
-    ///
-    MgInvalidCoordinateSystemTypeException(CREFSTRING methodName, INT32 lineNumber,
-        CREFSTRING fileName, MgStringCollection* whatArguments,
-        CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw();
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Destructor for a MgInvalidCoordinateSystemTypeException object.
-    ///
-    virtual ~MgInvalidCoordinateSystemTypeException() throw();
-
-INTERNAL_API:
-
-    DECLARE_EXCEPTION_DEFAULTS(MgInvalidCoordinateSystemTypeException)
-
-CLASS_ID:
-
-    static const INT32 m_cls_id = Geometry_Exception_MgInvalidCoordinateSystemTypeException;
-};
-
-#endif

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemUnitsException.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemUnitsException.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemUnitsException.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,40 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#include "Foundation.h"
-
-IMPLEMENT_EXCEPTION_DEFAULTS(MgInvalidCoordinateSystemUnitsException, MgApplicationException)
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Construct a MgInvalidCoordinateSystemUnitsException object.
-///
-MgInvalidCoordinateSystemUnitsException::MgInvalidCoordinateSystemUnitsException(CREFSTRING methodName,
-    INT32 lineNumber, CREFSTRING fileName, MgStringCollection* whatArguments,
-    CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw() :
-    MgApplicationException(methodName, lineNumber, fileName,
-        whatArguments, whyMessageId, whyArguments)
-{
-}
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Destruct the object.
-///
-MgInvalidCoordinateSystemUnitsException::~MgInvalidCoordinateSystemUnitsException() throw()
-{
-}

Deleted: sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemUnitsException.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemUnitsException.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Exception/InvalidCoordinateSystemUnitsException.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -1,69 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-/// \ingroup Exceptions_Module
-
-#ifndef MG_INVALID_COORDINATE_SYSTEM_UNITS_EXCEPTION_H_
-#define MG_INVALID_COORDINATE_SYSTEM_UNITS_EXCEPTION_H_
-
-///////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Thrown when the coordinate system units are invalid.
-///
-class MG_GEOMETRY_API MgInvalidCoordinateSystemUnitsException : public MgApplicationException
-{
-    DECLARE_CLASSNAME(MgInvalidCoordinateSystemUnitsException)
-
-EXTERNAL_API:
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Construct a MgInvalidCoordinateSystemUnitsException object.
-    ///
-    /// \param methodName
-    /// Name of the method where the exception occurred.
-    /// \param lineNumber
-    /// Line number where the exception occurred.
-    /// \param fileName
-    /// File name where the exception occurred.
-    /// \param whatArguments
-    /// Collection of arguments used to format the message that describes what the exception is.
-    /// \param whyMessageId
-    /// ID of the message that describes why the exception occurs.
-    /// \param whyArguments
-    /// Collection of arguments used to format the message that describes why the exception occurs.
-    ///
-    MgInvalidCoordinateSystemUnitsException(CREFSTRING methodName, INT32 lineNumber,
-        CREFSTRING fileName, MgStringCollection* whatArguments,
-        CREFSTRING whyMessageId, MgStringCollection* whyArguments) throw();
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Destructor for a MgInvalidCoordinateSystemUnitsException object.
-    ///
-    virtual ~MgInvalidCoordinateSystemUnitsException() throw();
-
-INTERNAL_API:
-
-    DECLARE_EXCEPTION_DEFAULTS(MgInvalidCoordinateSystemUnitsException)
-
-CLASS_ID:
-
-    static const INT32 m_cls_id = Geometry_Exception_MgInvalidCoordinateSystemUnitsException;
-};
-
-#endif

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/GeometricEntity.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/GeometricEntity.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/GeometricEntity.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -31,7 +31,7 @@
 //
 MgGeometricPathIterator* MgGeometricEntity::GetPath()
 {
-    throw new MgNotImplementedException(L"MgGeometricEntityImpl.GetPath", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgGeometricEntityImpl.GetPath", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 //////////////////////////////////////////////////////////////////

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/Geometry.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Geometry.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Geometry.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -143,7 +143,7 @@
         arguments.Add(L"1");
         arguments.Add(buffer);
 
-        throw new MgInvalidArgumentException(L"MgGeometry.Buffer",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgGeometry.Buffer",
             __LINE__, __WFILE__, &arguments, L"MgValueCannotBeZero", NULL);
     }
 

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/Geometry.vcxproj
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Geometry.vcxproj	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Geometry.vcxproj	2020-10-21 10:50:30 UTC (rev 9744)
@@ -390,66 +390,6 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     </ClCompile>
-    <ClCompile Include="Exception\CoordinateSystemComputationFailedException.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-    </ClCompile>
-    <ClCompile Include="Exception\CoordinateSystemConversionFailedException.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-    </ClCompile>
-    <ClCompile Include="Exception\CoordinateSystemInitializationFailedException.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-    </ClCompile>
-    <ClCompile Include="Exception\CoordinateSystemLoadFailedException.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-    </ClCompile>
-    <ClCompile Include="Exception\CoordinateSystemMeasureFailedException.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-    </ClCompile>
-    <ClCompile Include="Exception\CoordinateSystemTransformFailedException.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-    </ClCompile>
-    <ClCompile Include="Exception\GeometryException.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-    </ClCompile>
-    <ClCompile Include="Exception\InvalidCoordinateSystemException.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-    </ClCompile>
-    <ClCompile Include="Exception\InvalidCoordinateSystemTypeException.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-    </ClCompile>
-    <ClCompile Include="Exception\InvalidCoordinateSystemUnitsException.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-    </ClCompile>
     <ClCompile Include="GeometrySimplifier.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@@ -894,16 +834,6 @@
     <ClInclude Include="Buffer\wingedge.h" />
     <ClInclude Include="Buffer\worklist.h" />
     <ClInclude Include="Buffer\xordtree.h" />
-    <ClInclude Include="Exception\CoordinateSystemComputationFailedException.h" />
-    <ClInclude Include="Exception\CoordinateSystemConversionFailedException.h" />
-    <ClInclude Include="Exception\CoordinateSystemInitializationFailedException.h" />
-    <ClInclude Include="Exception\CoordinateSystemLoadFailedException.h" />
-    <ClInclude Include="Exception\CoordinateSystemMeasureFailedException.h" />
-    <ClInclude Include="Exception\CoordinateSystemTransformFailedException.h" />
-    <ClInclude Include="Exception\GeometryException.h" />
-    <ClInclude Include="Exception\InvalidCoordinateSystemException.h" />
-    <ClInclude Include="Exception\InvalidCoordinateSystemTypeException.h" />
-    <ClInclude Include="Exception\InvalidCoordinateSystemUnitsException.h" />
     <ClInclude Include="GeometrySimplifier.h" />
     <ClInclude Include="GeometrySimplificationAlgorithmType.h" />
     <ClInclude Include="GeosInclude.h" />

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/Geometry.vcxproj.filters
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Geometry.vcxproj.filters	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Geometry.vcxproj.filters	2020-10-21 10:50:30 UTC (rev 9744)
@@ -4,9 +4,6 @@
     <Filter Include="Buffer">
       <UniqueIdentifier>{56bc0c4e-6931-49c4-97b5-fe957c164eba}</UniqueIdentifier>
     </Filter>
-    <Filter Include="Exception">
-      <UniqueIdentifier>{47d9650a-b1ea-478c-94f5-afbd136dda2b}</UniqueIdentifier>
-    </Filter>
     <Filter Include="Parse">
       <UniqueIdentifier>{9be50487-b080-45ca-9ee4-edd823e4210e}</UniqueIdentifier>
     </Filter>
@@ -120,36 +117,6 @@
     <ClCompile Include="Buffer\xordtree.cpp">
       <Filter>Buffer</Filter>
     </ClCompile>
-    <ClCompile Include="Exception\CoordinateSystemComputationFailedException.cpp">
-      <Filter>Exception</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\CoordinateSystemConversionFailedException.cpp">
-      <Filter>Exception</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\CoordinateSystemInitializationFailedException.cpp">
-      <Filter>Exception</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\CoordinateSystemLoadFailedException.cpp">
-      <Filter>Exception</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\CoordinateSystemMeasureFailedException.cpp">
-      <Filter>Exception</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\CoordinateSystemTransformFailedException.cpp">
-      <Filter>Exception</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\GeometryException.cpp">
-      <Filter>Exception</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\InvalidCoordinateSystemException.cpp">
-      <Filter>Exception</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\InvalidCoordinateSystemTypeException.cpp">
-      <Filter>Exception</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\InvalidCoordinateSystemUnitsException.cpp">
-      <Filter>Exception</Filter>
-    </ClCompile>
     <ClCompile Include="Parse\ArrayHelper.cpp">
       <Filter>Parse</Filter>
     </ClCompile>
@@ -508,36 +475,6 @@
     <ClInclude Include="Buffer\xordtree.h">
       <Filter>Buffer</Filter>
     </ClInclude>
-    <ClInclude Include="Exception\CoordinateSystemComputationFailedException.h">
-      <Filter>Exception</Filter>
-    </ClInclude>
-    <ClInclude Include="Exception\CoordinateSystemConversionFailedException.h">
-      <Filter>Exception</Filter>
-    </ClInclude>
-    <ClInclude Include="Exception\CoordinateSystemInitializationFailedException.h">
-      <Filter>Exception</Filter>
-    </ClInclude>
-    <ClInclude Include="Exception\CoordinateSystemLoadFailedException.h">
-      <Filter>Exception</Filter>
-    </ClInclude>
-    <ClInclude Include="Exception\CoordinateSystemMeasureFailedException.h">
-      <Filter>Exception</Filter>
-    </ClInclude>
-    <ClInclude Include="Exception\CoordinateSystemTransformFailedException.h">
-      <Filter>Exception</Filter>
-    </ClInclude>
-    <ClInclude Include="Exception\GeometryException.h">
-      <Filter>Exception</Filter>
-    </ClInclude>
-    <ClInclude Include="Exception\InvalidCoordinateSystemException.h">
-      <Filter>Exception</Filter>
-    </ClInclude>
-    <ClInclude Include="Exception\InvalidCoordinateSystemTypeException.h">
-      <Filter>Exception</Filter>
-    </ClInclude>
-    <ClInclude Include="Exception\InvalidCoordinateSystemUnitsException.h">
-      <Filter>Exception</Filter>
-    </ClInclude>
     <ClInclude Include="Parse\Array.h">
       <Filter>Parse</Filter>
     </ClInclude>

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/GeometryBuild.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/GeometryBuild.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/GeometryBuild.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -121,15 +121,4 @@
 #include "CoordinateSystem/CoordinateSystemCache.cpp"
 #include "CoordinateSystem/CoordinateSystemFactory.cpp"
 
-#include "Exception/CoordinateSystemComputationFailedException.cpp"
-#include "Exception/CoordinateSystemConversionFailedException.cpp"
-#include "Exception/CoordinateSystemInitializationFailedException.cpp"
-#include "Exception/CoordinateSystemLoadFailedException.cpp"
-#include "Exception/CoordinateSystemMeasureFailedException.cpp"
-#include "Exception/CoordinateSystemTransformFailedException.cpp"
-#include "Exception/GeometryException.cpp"
-#include "Exception/InvalidCoordinateSystemException.cpp"
-#include "Exception/InvalidCoordinateSystemTypeException.cpp"
-#include "Exception/InvalidCoordinateSystemUnitsException.cpp"
-
 #include "GeometryClassFactory.cpp"

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/GeometryClassFactory.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/GeometryClassFactory.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/GeometryClassFactory.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -48,17 +48,6 @@
     fact->Register(Geometry_CoordinateXYZM, MgCoordinateXYZM::CreateObject);
     fact->Register(Geometry_CoordinateXYM, MgCoordinateXYM::CreateObject);
 
-    EXCEPTION_CLASS_CREATOR(MgCoordinateSystemComputationFailedException)
-    EXCEPTION_CLASS_CREATOR(MgCoordinateSystemConversionFailedException)
-    EXCEPTION_CLASS_CREATOR(MgCoordinateSystemInitializationFailedException)
-    EXCEPTION_CLASS_CREATOR(MgCoordinateSystemLoadFailedException)
-    EXCEPTION_CLASS_CREATOR(MgCoordinateSystemMeasureFailedException)
-    EXCEPTION_CLASS_CREATOR(MgCoordinateSystemTransformFailedException)
-    EXCEPTION_CLASS_CREATOR(MgGeometryException)
-    EXCEPTION_CLASS_CREATOR(MgInvalidCoordinateSystemException)
-    EXCEPTION_CLASS_CREATOR(MgInvalidCoordinateSystemTypeException)
-    EXCEPTION_CLASS_CREATOR(MgInvalidCoordinateSystemUnitsException)
-
     return true;
 }
 

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/GeometryClassId.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/GeometryClassId.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/GeometryClassId.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -135,6 +135,9 @@
 #define CoordinateSystem_CoordinateSystemGeodeticStandaloneTransformDefParams           GEOMETRY_COORDINATE_SYSTEM_ID+46
 
 // Exceptions
+//
+// NOTE: Although we removed these exceptions, we are keeping the ids in to prevent these ids from being
+// accidentally used for new classes in the future
 #define Geometry_Exception_MgCoordinateSystemComputationFailedException     GEOMETRY_EXCEPTION_ID+0
 #define Geometry_Exception_MgCoordinateSystemConversionFailedException      GEOMETRY_EXCEPTION_ID+1
 #define Geometry_Exception_MgCoordinateSystemInitializationFailedException  GEOMETRY_EXCEPTION_ID+2

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/GeometryCommon.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/GeometryCommon.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/GeometryCommon.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -169,17 +169,6 @@
 #include "CoordinateSystem/CoordinateSystemMgrs.h"                          //for MgCoordinateSystemMgrs
 #include "CoordinateSystem/CoordinateSystemFactory.h"
 
-#include "Exception/CoordinateSystemComputationFailedException.h"
-#include "Exception/CoordinateSystemConversionFailedException.h"
-#include "Exception/CoordinateSystemInitializationFailedException.h"
-#include "Exception/CoordinateSystemLoadFailedException.h"
-#include "Exception/CoordinateSystemMeasureFailedException.h"
-#include "Exception/CoordinateSystemTransformFailedException.h"
-#include "Exception/GeometryException.h"
-#include "Exception/InvalidCoordinateSystemException.h"
-#include "Exception/InvalidCoordinateSystemTypeException.h"
-#include "Exception/InvalidCoordinateSystemUnitsException.h"
-
 // Represent NAN for double
 #define DoubleNan std::numeric_limits<double>::quiet_NaN()
 

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/GeometrySimplifier.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/GeometrySimplifier.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/GeometrySimplifier.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -41,7 +41,7 @@
     if (algorithm != MgGeometrySimplificationAlgorithmType::DouglasPeucker &&
         algorithm != MgGeometrySimplificationAlgorithmType::TopologyPreserving)
     {
-        throw new MgInvalidArgumentException(L"MgGeometrySimplifier.Simplify", __LINE__, __WFILE__, NULL, L"MgInvalidGeometrySimplficationAlgorithm", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgGeometrySimplifier.Simplify", __LINE__, __WFILE__, NULL, L"MgInvalidGeometrySimplficationAlgorithm", NULL);
     }
 
     STRING inputWKt = geom->ToAwkt(true);

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/LineString.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/LineString.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/LineString.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -35,7 +35,7 @@
         arguments.Add(L"1");
         arguments.Add(buffer);
 
-        throw new MgInvalidArgumentException(L"MgLineString.MgLineString",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgLineString.MgLineString",
             __LINE__, __WFILE__, &arguments, L"MgInvalidGeometryTooFewCoordinates", NULL);
     }
 

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/LinearRing.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/LinearRing.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/LinearRing.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -33,7 +33,7 @@
         arguments.Add(L"1");
         arguments.Add(buffer);
 
-        throw new MgInvalidArgumentException(L"MgLinearRing.MgLinearRing",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgLinearRing.MgLinearRing",
             __LINE__, __WFILE__, &arguments, L"MgInvalidGeometryTooFewCoordinates", NULL);
     }
 
@@ -161,7 +161,7 @@
 {
     //should not be called on geometry components
     //components are serialized by the containing geometries
-    throw new MgNotImplementedException(L"MgLinearRing.Serialize", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgLinearRing.Serialize", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 //////////////////////////////////////////////////////////////////
@@ -171,7 +171,7 @@
 {
     //should not be called on geometry components
     //components are deserialized by the containing geometries
-    throw new MgNotImplementedException(L"MgLinearRing.Deserialize", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgLinearRing.Deserialize", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 ///////////////////////////////////////////////////////////////////////////

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/LinearSegment.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/LinearSegment.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/LinearSegment.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -34,7 +34,7 @@
         arguments.Add(L"1");
         arguments.Add(buffer);
 
-        throw new MgInvalidArgumentException(L"MgLinearSegment.MgLinearSegment",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgLinearSegment.MgLinearSegment",
             __LINE__, __WFILE__, &arguments, L"MgInvalidGeometryTooFewCoordinates", NULL);
     }
 
@@ -152,7 +152,7 @@
 {
     //should not be called on geometry components
     //components are serialized by the containing geometries
-    throw new MgNotImplementedException(L"MgLinearSegment.Serialize", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgLinearSegment.Serialize", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 //////////////////////////////////////////////////////////////////
@@ -162,7 +162,7 @@
 {
     //should not be called on geometry components
     //components are deserialized by the containing geometries
-    throw new MgNotImplementedException(L"MgLinearSegment.Deserialize", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgLinearSegment.Deserialize", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 //////////////////////////////////////////////////////////////////

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/Parse/Array.h
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Parse/Array.h	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Parse/Array.h	2020-10-21 10:50:30 UTC (rev 9744)
@@ -324,7 +324,7 @@
 {
     if (i >= GetCount() || i < 0)
     {
-        throw new MgIndexOutOfRangeException(L"GisArray<T>.GetValue", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgIndexOutOfRangeException, L"GisArray<T>.GetValue", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     return *(this->GetData()+i);
@@ -335,7 +335,7 @@
 T& GisArray<T>::GetValue(INT32 i)
 {
     if (i >= GetCount() || i < 0)
-        throw new MgIndexOutOfRangeException(L"GisArray<T>.GetValue", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgIndexOutOfRangeException, L"GisArray<T>.GetValue", __LINE__, __WFILE__, NULL, L"", NULL);
 
     return *(this->GetData()+i);
 }
@@ -345,7 +345,7 @@
 void GisArray<T>::SetValue(INT32 i, T newElement)
 {
     if (i >= GetCount() || i < 0)
-        throw new MgIndexOutOfRangeException(L"GisArray<T>.SetValue", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgIndexOutOfRangeException, L"GisArray<T>.SetValue", __LINE__, __WFILE__, NULL, L"", NULL);
 
     *(this->GetData()+i) = newElement;
 }

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/Parse/ArrayHelper.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Parse/ArrayHelper.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Parse/ArrayHelper.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -27,7 +27,7 @@
 {
     // Disallow possible re-allocation if object is shared.
     if (array->m_metadata.refCount > 1)
-        throw new MgInvalidOperationException(L"GisArrayHelper.Append", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"GisArrayHelper.Append", __LINE__, __WFILE__, NULL, L"", NULL);
 
     if ( array->m_metadata.size + numElements > array->m_metadata.alloc )
         array = AllocMore(array, numElements, false /*exactly*/, elementSize);   // We could calculate the difference here, allocating less.
@@ -44,7 +44,7 @@
 {
     // Disallow possible re-allocation if object is shared.
     if (array->m_metadata.refCount > 1)
-        throw new MgInvalidOperationException(L"GisArrayHelper.SetSize", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"GisArrayHelper.SetSize", __LINE__, __WFILE__, NULL, L"", NULL);
 
     if ( numElements > array->m_metadata.alloc )
     {
@@ -67,10 +67,10 @@
 {
     // Disallow possible re-allocation if object is shared.
     if (array->m_metadata.refCount > 1)
-        throw new MgInvalidOperationException(L"GisArrayHelper.SetAlloc", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"GisArrayHelper.SetAlloc", __LINE__, __WFILE__, NULL, L"", NULL);
 
     if (numElements < array->m_metadata.size || numElements < MIN_ALLOC)
-        throw new MgInvalidOperationException(L"GisArrayHelper.SetAlloc", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"GisArrayHelper.SetAlloc", __LINE__, __WFILE__, NULL, L"", NULL);
 
     if (array->m_metadata.alloc != numElements)
     {
@@ -131,7 +131,7 @@
 
     GenericArray* newArray = (GenericArray*) new unsigned char[newAllocBytes];
     if (0==newArray)
-        throw new MgOutOfMemoryException(L"GisArrayHelper.AllocMore", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"GisArrayHelper.AllocMore", __LINE__, __WFILE__, NULL, L"", NULL);
 
     // Copy data from old array.
     if (0!=array)

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/Parse/LexAwkt.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Parse/LexAwkt.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Parse/LexAwkt.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -321,7 +321,7 @@
         if (!iswdigit(m_ch))
         {
             // Exponent shall contain digits
-            throw new MgNotFiniteNumberException(L"GisLexAwkt.getnumber", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgNotFiniteNumberException, L"GisLexAwkt.getnumber", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         pstr = getdigits(pstr);
         *pstr = CHR_NULL;

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/Parse/ParseAwkt.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Parse/ParseAwkt.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Parse/ParseAwkt.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -94,7 +94,7 @@
         arguments.Add(L"1");
         arguments.Add(pwzAwkt);
 
-        throw new MgInvalidArgumentException(L"MgParseAwkt.ParseAwkt",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgParseAwkt.ParseAwkt",
             __LINE__, __WFILE__, &arguments, L"MgInvalidAgfText", NULL);
     }
 
@@ -544,7 +544,7 @@
         m_types->GetCount() != m_dims->GetCount() ||
         m_types->GetCount() != m_starts->GetCount())
     {
-        throw new MgInvalidArgumentException(L"MgParseAwkt.ParseAwkt", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgParseAwkt.ParseAwkt", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     _types type = (_types) (*m_types)[0];
@@ -617,7 +617,7 @@
             arguments.Add(L"1");
             arguments.Add(buffer);
 
-            throw new MgInvalidArgumentException(L"MgParseAwkt.SetGeometryType",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgParseAwkt.SetGeometryType",
                 __LINE__, __WFILE__, &arguments, L"MgInvalidAgfText", NULL);
         }
         break;
@@ -804,7 +804,7 @@
             arguments.Add(L"0");
             arguments.Add(buffer);
 
-            throw new MgInvalidArgumentException(L"MgParseAwkt.ParseAwkt",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgParseAwkt.ParseAwkt",
                 __LINE__, __WFILE__, &arguments, L"MgInvalidAgfText", NULL);
         }
         break;

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/Polygon.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Polygon.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Polygon.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -60,7 +60,7 @@
 MgLinearRing* MgPolygon::GetInteriorRing(INT32 index)
 {
     if (m_innerRings == NULL)
-        throw new MgArgumentOutOfRangeException(L"MgPolygon.GetInteriorRing", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgArgumentOutOfRangeException, L"MgPolygon.GetInteriorRing", __LINE__, __WFILE__, NULL, L"", NULL);
 
     return m_innerRings->GetItem(index);
 }

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/Spatial/MathUtility.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Spatial/MathUtility.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Spatial/MathUtility.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -87,7 +87,7 @@
         arguments.Add(L"1");
         arguments.Add(buffer);
 
-        throw new MgInvalidArgumentException(L"MgMathUtility.LUDecompose",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgMathUtility.LUDecompose",
             __LINE__, __WFILE__, &arguments, L"MgInvalidGeometryNoDimension", NULL);
     }
 
@@ -182,7 +182,7 @@
             arguments.Add(L"3");
             arguments.Add(buffer);
 
-            throw new MgInvalidArgumentException(L"MgMathUtility.LUDecompose",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgMathUtility.LUDecompose",
                 __LINE__, __WFILE__, &arguments, L"MgInvalidGeometryBadProportion", NULL);
         }
 

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/Spatial/SpatialUtility.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Spatial/SpatialUtility.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Spatial/SpatialUtility.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -58,7 +58,7 @@
         arguments.Add(L"2");
         arguments.Add(buffer);
 
-        throw new MgInvalidArgumentException(L"MgSpatialUtility.ApproximateGeometryWithLineStrings",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgSpatialUtility.ApproximateGeometryWithLineStrings",
             __LINE__, __WFILE__, &arguments, L"MgValueCannotBeLessThanZero", NULL);
     }
 
@@ -71,7 +71,7 @@
         arguments.Add(L"3");
         arguments.Add(buffer);
 
-        throw new MgInvalidArgumentException(L"MgSpatialUtility.ApproximateGeometryWithLineStrings",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgSpatialUtility.ApproximateGeometryWithLineStrings",
             __LINE__, __WFILE__, &arguments, L"MgValueCannotBeLessThanZero", NULL);
     }
 
@@ -170,7 +170,7 @@
             arguments.Add(L"1");
             arguments.Add(buffer);
 
-            throw new MgInvalidArgumentException(L"MgSpatialUtility.ApproximateGeometryWithLineStrings",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgSpatialUtility.ApproximateGeometryWithLineStrings",
                 __LINE__, __WFILE__, &arguments, L"MgInvalidGeometryType", NULL);
         }
     }
@@ -247,7 +247,7 @@
                 arguments.Add(L"2");
                 arguments.Add(buffer);
 
-                throw new MgInvalidArgumentException(L"MgSpatialUtility.AppendLinearizedCurveSegmentsToDistinctCollection",
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgSpatialUtility.AppendLinearizedCurveSegmentsToDistinctCollection",
                     __LINE__, __WFILE__, &arguments, L"MgInvalidGeometryComponentType", NULL);
             }
         }
@@ -558,7 +558,7 @@
     CHECKARGUMENTNULL(seg2To, L"MgSpatialUtility.SegmentIntersection")
     if (magnitude < 1.0E-04)
     {
-        throw new MgInvalidArgumentException(L"MgSpatialUtility.SegmentIntersection", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgSpatialUtility.SegmentIntersection", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     // Compute a tolerance which is appropriate for the data we are working

Modified: sandbox/jng/flatten_exceptions/Common/Geometry/Spatial/SpatialUtilityCircularArc.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Common/Geometry/Spatial/SpatialUtilityCircularArc.cpp	2020-10-21 10:17:49 UTC (rev 9743)
+++ sandbox/jng/flatten_exceptions/Common/Geometry/Spatial/SpatialUtilityCircularArc.cpp	2020-10-21 10:50:30 UTC (rev 9744)
@@ -339,7 +339,7 @@
     if (MgMathUtility::LUDecompose(3, a, eindex ) == 0)
     {
         // Zero result means that points were collinear.
-        throw new MgInvalidArgumentException(L"MgSpatialUtilityCircularArc.ComputeCenterFromThreePositions", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgSpatialUtilityCircularArc.ComputeCenterFromThreePositions", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     /* Perform row exchanges for b */
@@ -388,7 +388,7 @@
         arguments.Add(L"2");
         arguments.Add(buffer);
 
-        throw new MgInvalidArgumentException(L"MgSpatialUtilityCircularArc.Linearize",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgSpatialUtilityCircularArc.Linearize",
             __LINE__, __WFILE__, &arguments, L"MgValueCannotBeLessThanZero", NULL);
     }
 
@@ -401,7 +401,7 @@
         arguments.Add(L"3");
         arguments.Add(buffer);
 
-        throw new MgInvalidArgumentException(L"MgSpatialUtilityCircularArc.Linearize",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgSpatialUtilityCircularArc.Linearize",
             __LINE__, __WFILE__, &arguments, L"MgValueCannotBeLessThanZero", NULL);
     }
 
@@ -540,7 +540,7 @@
 
         MgStringCollection arguments;
         arguments.Add(buffer);
-        throw new MgInvalidArgumentException(L"MgSpatialUtilityCircularArc.BestArcStep", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgSpatialUtilityCircularArc.BestArcStep", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     if (MgMathUtility::SnapToZero(maximumError) <= 0.0)
@@ -550,7 +550,7 @@
 
         MgStringCollection arguments;
         arguments.Add(buffer);
-        throw new MgInvalidArgumentException(L"MgSpatialUtilityCircularArc.BestArcStep", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgSpatialUtilityCircularArc.BestArcStep", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     double arcStep = 0.0;



More information about the mapguide-commits mailing list