[mapguide-commits] r9749 - in sandbox/jng/flatten_exceptions/Desktop: DesktopUnmanagedApi DesktopUnmanagedApi/DotNet DesktopUnmanagedApi/JavaApiEx DesktopUnmanagedApi/MapGuideApi MgDesktop MgDesktop/Log MgDesktop/MapLayer MgDesktop/Services MgDesktop/Services/Drawing MgDesktop/Services/Feature MgDesktop/Services/Feature/Commands MgDesktop/Services/Rendering MgDesktop/Services/Resource MgDesktop/Services/Stylization MgDesktop/Services/Tile MgDesktop/System UnitTest

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Oct 22 08:43:38 PDT 2020


Author: jng
Date: 2020-10-22 08:43:37 -0700 (Thu, 22 Oct 2020)
New Revision: 9749

Added:
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ExceptionCodes.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ExceptionCodes.h
Removed:
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Exception/
Modified:
   sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/DotNet/MapGuideDesktopApiGen.xml
   sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/DotNet/MapGuideDesktopConstants.xml
   sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/JavaApiEx/catchall.code
   sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/MapGuideApi/Constants.xml
   sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/MapGuideApi/MapGuideApiGen.xml
   sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/catchall.code
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Log/LogManager.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Log/LogThread.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Layer.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Layer.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Map.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Map.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Selection.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MgDesktop.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MgDesktop.vcxproj
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MgDesktop.vcxproj.filters
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MgDesktopBuild.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ByteSourceRasterStreamImpl.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/CryptoDefs.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/DataReader.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/DataReader.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Drawing/DrawingDefs.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Drawing/DrawingServiceUtil.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Drawing/DrawingServiceUtil.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/DrawingService.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/DrawingService.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/ApplySchema.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/CreateFeatureSource.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/CreateFeatureSource.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/DescribeSchema.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/EnumerateDataStores.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/ExtendedSelectCommand.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/ExtendedSelectCommand.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/FeatureManipulationCommand.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetConnectionPropertyValues.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetLongTransactions.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetProviderCapabilities.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetSchemaMapping.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetSpatialContexts.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/InsertCommand.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/SelectAggregateCommand.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/SelectCommand.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/SelectFeatures.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/SqlCommand.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/UpdateFeatures.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FdoConnectionPool.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FdoConnectionUtil.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FdoConnectionUtil.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FdoForcedOneToOneFeatureReader.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureClassCacheItem.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureClassCacheItem.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureConnection.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureConnection.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureDefs.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureDistribution.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureGeometricFunctions.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureNumericFunctions.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSchemaCacheItem.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSchemaCacheItem.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureServiceCache.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureServiceCache.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureServiceCacheEntry.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureServiceCacheEntry.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSetReader.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSetReader.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSourceCacheItem.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSourceCacheItem.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureStringFunctions.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureUtil.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureUtil.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/GwsFeatureReader.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/JoinFeatureReader.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/MgCSTrans.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/MgCSTrans.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/ProjectedFeatureReader.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/ProjectedFeatureReader.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/ProxyDataReader.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/RasterHelper.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/RasterHelper.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/RdbmsFeatureSourceParams.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/RdbmsFeatureSourceParams.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/SpatialContextCacheItem.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/SpatialContextCacheItem.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/TransformCache.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/TransformCache.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/FeatureReader.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/FeatureReader.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/FeatureService.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ImageFormats.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ImageFormats.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/MappingService.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ProfilingService.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/FeatureInfoRenderer.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/FeatureInfoRenderer.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/LegendPlotUtil.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/LegendPlotUtil.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/MapPlot.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/MappingDefs.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/MappingUtil.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/MappingUtil.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/PlotSpecification.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/PrintLayout.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgFeatureReader.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgFeatureReader.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgInputStream.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgRaster.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgRaster.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgSymbolManager.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgSymbolManager.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RenderingOptions.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RenderingOptions.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/RenderingService.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/RenderingService.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ByteSourceDwfInputStreamImpl.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ByteSourceDwfInputStreamImpl.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/OperationInfo.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/OperationInfo.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/OperationParameter.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/OperationParameter.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourceContentCache.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourceContentCache.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourceDefs.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourceDefs.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageHandler.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageHandler.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageLoader.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageLoader.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageManifestHandler.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageManifestHandler.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageManifestParser.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageManifestParser.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/UnmanagedDataManager.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/UnmanagedDataType.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/UnmanagedDataType.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ZipFileHandler.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ZipFileHandler.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ZipFileReader.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ZipFileReader.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ResourceService.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ResourceService.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ScrollableFeatureReader.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ScrollableFeatureReader.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ServiceFactory.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ServiceFactory.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/SqlReader.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/SqlReader.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Stylization/SEMgSymbolManager.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Stylization/SEMgSymbolManager.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Tile/TileCache.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Tile/TileCache.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Tile/TileDefs.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Tile/TileDefs.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/TileService.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/TileService.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Transaction.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Transaction.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ClassId.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ConfigProperties.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ConfigProperties.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/PlatformInit.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/PlatformInit.h
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/TimerUtil.cpp
   sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/TimerUtil.h
   sandbox/jng/flatten_exceptions/Desktop/UnitTest/CatchHelperMacros.h
   sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestFeatureService.cpp
   sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestLogManagerThread.cpp
   sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestPerformance.cpp
   sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestResourceService.cpp
   sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestServiceFactory.cpp
   sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestTileService.cpp
Log:
Remove all exceptions from mg-desktop and modify all throws to throw MgException, passing an exception code instead. Remove all non-MgException classes from SWIG config files. Add MgExceptionCodes to SWIG constants files.

Modified: sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/DotNet/MapGuideDesktopApiGen.xml
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/DotNet/MapGuideDesktopApiGen.xml	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/DotNet/MapGuideDesktopApiGen.xml	2020-10-22 15:43:37 UTC (rev 9749)
@@ -88,22 +88,6 @@
     
     <!-- MapGuideDesktop classes -->
 
-    <Header path="../../MgDesktop/Exception/AliasNotFoundException.h" />
-    <Header path="../../MgDesktop/Exception/ConnectionFailedException.h" />
-    <Header path="../../MgDesktop/Exception/DuplicateParameterException.h" />
-    <Header path="../../MgDesktop/Exception/DwfException.h" />
-    <Header path="../../MgDesktop/Exception/DwfSectionNotFoundException.h" />
-    <Header path="../../MgDesktop/Exception/DwfSectionResourceNotFoundException.h" />
-    <Header path="../../MgDesktop/Exception/InvalidDwfPackageException.h" />
-    <Header path="../../MgDesktop/Exception/InvalidDwfSectionException.h" />
-    <Header path="../../MgDesktop/Exception/InvalidFeatureSourceException.h" />
-    <Header path="../../MgDesktop/Exception/InvalidLogEntryException.h" />
-    <Header path="../../MgDesktop/Exception/InvalidPrintLayoutFontSizeUnitsException.h" />
-    <Header path="../../MgDesktop/Exception/InvalidPrintLayoutPositionUnitsException.h" />
-    <Header path="../../MgDesktop/Exception/InvalidPrintLayoutSizeUnitsException.h" />
-    <Header path="../../MgDesktop/Exception/ParameterNotFoundException.h" />
-    <Header path="../../MgDesktop/Exception/StylizeLayerFailedException.h" />
-
     <Header path="../../MgDesktop/Services/DataReader.h" />
     <Header path="../../MgDesktop/Services/DrawingService.h" />
     <Header path="../../MgDesktop/Services/FeatureReader.h" />
@@ -130,6 +114,7 @@
     <Header path="../../MgDesktop/Services/Rendering/RenderingOptions.h" />
 
     <Header path="../../MgDesktop/System/PlatformInit.h" />
+    <Header path="../../MgDesktop/System/ExceptionCodes.h" />
 
     <Header path="../../MgDesktop/MapLayer/Layer.h" />
     <Header path="../../MgDesktop/MapLayer/Map.h" />

Modified: sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/DotNet/MapGuideDesktopConstants.xml
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/DotNet/MapGuideDesktopConstants.xml	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/DotNet/MapGuideDesktopConstants.xml	2020-10-22 15:43:37 UTC (rev 9749)
@@ -77,6 +77,7 @@
     <Class name="MgdUnitType" />
     <Class name="MgdPageUnitsType" />
     <Class name="MgdImageFormats" />
+    <Class name="MgdExceptionCodes" />
 </Classes>
 
 <!--
@@ -87,6 +88,7 @@
     <Header path="../../MgDesktop/Services/ImageFormats.h" />
     <Header path="../../MgDesktop/Services/Rendering/MapPlotInstruction.h" />
     <Header path="../../MgDesktop/Services/Rendering/UnitType.h" />
+    <Header path="../../MgDesktop/System/ExceptionCodes.h" />
 </Headers>
 
 </Parameters>

Modified: sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/JavaApiEx/catchall.code
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/JavaApiEx/catchall.code	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/JavaApiEx/catchall.code	2020-10-22 15:43:37 UTC (rev 9749)
@@ -3,6 +3,6 @@
 {
     string s = proxyfname;
     wstring fname = MgUtil::MultiByteToWideChar(s);
-    MgUnclassifiedException* e = new MgUnclassifiedException(fname, __LINE__, __WFILE__, NULL, L"", NULL);
+    MgException* e = new MgException(MgExceptionCodes::MgUnclassifiedException, fname, __LINE__, __WFILE__, nullptr, L"", nullptr);
     ThrowJavaExceptionWrapper(jenv, e);
 }

Modified: sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/MapGuideApi/Constants.xml
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/MapGuideApi/Constants.xml	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/MapGuideApi/Constants.xml	2020-10-22 15:43:37 UTC (rev 9749)
@@ -123,6 +123,7 @@
   <Class name="MgUnitType" />
   <Class name="MgPackageStatus" />
   <Class name="MgRasterDataModelType" />
+  <Class name="MgExceptionCodes" />
 </Classes>
 
 <!--
@@ -136,6 +137,7 @@
     <Header path="../../../Common/Foundation/Data/FeaturePropertyType.h" />
     <Header path="../../../Common/Foundation/Data/MimeType.h" />
     <Header path="../../../Common/Foundation/Data/PropertyType.h" />
+    <Header path="../../../Common/Foundation/Exception/ExceptionCodes.h" />
 
     <Header path="../../../Common/PlatformBase/MapLayer/LayerGroupType.h" />
     <Header path="../../../Common/PlatformBase/MapLayer/LayerType.h" />

Modified: sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/MapGuideApi/MapGuideApiGen.xml
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/MapGuideApi/MapGuideApiGen.xml	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/MapGuideApi/MapGuideApiGen.xml	2020-10-22 15:43:37 UTC (rev 9749)
@@ -108,55 +108,8 @@
     <Header path="../../../Common/Foundation/Data/StringProperty.h" />
 
     <Header path="../../../Common/Foundation/Exception/Exception.h" />
-    <Header path="../../../Common/Foundation/Exception/SystemException.h" />
-    <Header path="../../../Common/Foundation/Exception/IoException.h" />
-    <Header path="../../../Common/Foundation/Exception/FileIoException.h" />
-    <Header path="../../../Common/Foundation/Exception/StreamIoException.h" />
-    <Header path="../../../Common/Foundation/Exception/OutOfRangeException.h" />
+    <Header path="../../../Common/Foundation/Exception/ExceptionCodes.h" />
 
-    <Header path="../../../Common/Foundation/Exception/ApplicationException.h" />
-    <Header path="../../../Common/Foundation/Exception/ArgumentOutOfRangeException.h" />
-    <Header path="../../../Common/Foundation/Exception/ClassNotFoundException.h" />
-    <Header path="../../../Common/Foundation/Exception/ConfigurationException.h" />
-    <Header path="../../../Common/Foundation/Exception/ConfigurationLoadFailedException.h" />
-    <Header path="../../../Common/Foundation/Exception/ConfigurationSaveFailedException.h" />
-    <Header path="../../../Common/Foundation/Exception/DateTimeException.h" />
-    <Header path="../../../Common/Foundation/Exception/DecryptionException.h" />
-    <Header path="../../../Common/Foundation/Exception/DirectoryNotFoundException.h" />
-    <Header path="../../../Common/Foundation/Exception/DivideByZeroException.h" />
-    <Header path="../../../Common/Foundation/Exception/DomainException.h" />
-    <Header path="../../../Common/Foundation/Exception/DuplicateDirectoryException.h" />
-    <Header path="../../../Common/Foundation/Exception/DuplicateFileException.h" />
-    <Header path="../../../Common/Foundation/Exception/DuplicateObjectException.h" />
-    <Header path="../../../Common/Foundation/Exception/EncryptionException.h" />
-    <Header path="../../../Common/Foundation/Exception/FileNotFoundException.h" />
-    <Header path="../../../Common/Foundation/Exception/IndexOutOfRangeException.h" />
-    <Header path="../../../Common/Foundation/Exception/InvalidArgumentException.h" />
-    <Header path="../../../Common/Foundation/Exception/InvalidCastException.h" />
-    <Header path="../../../Common/Foundation/Exception/InvalidOperationException.h" />
-    <Header path="../../../Common/Foundation/Exception/InvalidPropertyTypeException.h" />
-    <Header path="../../../Common/Foundation/Exception/InvalidStreamHeaderException.h" />
-    <Header path="../../../Common/Foundation/Exception/LengthException.h" />
-    <Header path="../../../Common/Foundation/Exception/LogicException.h" />
-    <Header path="../../../Common/Foundation/Exception/NotFiniteNumberException.h" />
-    <Header path="../../../Common/Foundation/Exception/NotImplementedException.h" />
-    <Header path="../../../Common/Foundation/Exception/NullArgumentException.h" />
-    <Header path="../../../Common/Foundation/Exception/NullPropertyValueException.h" />
-    <Header path="../../../Common/Foundation/Exception/NullReferenceException.h" />
-    <Header path="../../../Common/Foundation/Exception/ObjectNotFoundException.h" />
-    <Header path="../../../Common/Foundation/Exception/OutOfMemoryException.h" />
-    <Header path="../../../Common/Foundation/Exception/OverflowException.h" />
-    <Header path="../../../Common/Foundation/Exception/PlatformNotSupportedException.h" />
-    <Header path="../../../Common/Foundation/Exception/ResourcesException.h" />
-    <Header path="../../../Common/Foundation/Exception/ResourcesLoadFailedException.h" />
-    <Header path="../../../Common/Foundation/Exception/RuntimeException.h" />
-    <Header path="../../../Common/Foundation/Exception/TemporaryFileNotAvailableException.h" />
-    <Header path="../../../Common/Foundation/Exception/ThirdPartyException.h" />
-    <Header path="../../../Common/Foundation/Exception/UnclassifiedException.h" />
-    <Header path="../../../Common/Foundation/Exception/UnderflowException.h" />
-    <Header path="../../../Common/Foundation/Exception/XmlException.h" />
-    <Header path="../../../Common/Foundation/Exception/XmlParserException.h" />
-
     <!-- Geometry classes -->
 
     <Header path="../../../Common/Geometry/GeometricEntity.h" />
@@ -244,17 +197,6 @@
     <Header path="../../../Common/Geometry/CoordinateSystem/CoordinateSystemTransform.h" />
     <Header path="../../../Common/Geometry/CoordinateSystem/CoordinateSystemUnitInformation.h" />
 
-    <Header path="../../../Common/Geometry/Exception/CoordinateSystemComputationFailedException.h" />
-    <Header path="../../../Common/Geometry/Exception/CoordinateSystemConversionFailedException.h" />
-    <Header path="../../../Common/Geometry/Exception/CoordinateSystemInitializationFailedException.h" />
-    <Header path="../../../Common/Geometry/Exception/CoordinateSystemLoadFailedException.h" />
-    <Header path="../../../Common/Geometry/Exception/CoordinateSystemMeasureFailedException.h" />
-    <Header path="../../../Common/Geometry/Exception/CoordinateSystemTransformFailedException.h" />
-    <Header path="../../../Common/Geometry/Exception/GeometryException.h" />
-    <Header path="../../../Common/Geometry/Exception/InvalidCoordinateSystemException.h" />
-    <Header path="../../../Common/Geometry/Exception/InvalidCoordinateSystemTypeException.h" />
-    <Header path="../../../Common/Geometry/Exception/InvalidCoordinateSystemUnitsException.h" />
-
     <!-- PlatformBase classes -->
 
     <Header path="../../../Common/PlatformBase/Data/BlobProperty.h" />
@@ -272,29 +214,6 @@
     <Header path="../../../Common/PlatformBase/Data/SingleProperty.h" />
     <Header path="../../../Common/PlatformBase/Data/StringPropertyCollection.h" />
 
-    <Header path="../../../Common/PlatformBase/Exception/ArrayTypeMismatchException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/DuplicateResourceDataException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/DuplicateResourceException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/EmptyFeatureSetException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/FdoException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/FeatureServiceException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/InvalidMapDefinitionException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/InvalidRepositoryNameException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/InvalidRepositoryTypeException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/InvalidResourceDataNameException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/InvalidResourceDataTypeException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/InvalidResourceNameException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/InvalidResourcePathException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/InvalidResourcePreProcessingTypeException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/InvalidResourceTypeException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/LayerNotFoundException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/ResourceBusyException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/ResourceDataNotFoundException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/ResourceNotFoundException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/ServiceNotAvailableException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/ServiceNotSupportedException.h" />
-    <Header path="../../../Common/PlatformBase/Exception/UserNotFoundException.h" />
-
     <Header path="../../../Common/PlatformBase/Services/FeatureCommand.h" />
     <Header path="../../../Common/PlatformBase/Services/FeatureQueryOptions.h" />
     <Header path="../../../Common/PlatformBase/Services/FeatureSourceParams.h" />
@@ -346,21 +265,6 @@
     <Header path="../../../Common/PlatformBase/MapLayer/SelectionBase.h" />
 
     <!-- mg-desktop classes -->
-    <Header path="../../MgDesktop/Exception/AliasNotFoundException.h" />
-    <Header path="../../MgDesktop/Exception/ConnectionFailedException.h" />
-    <Header path="../../MgDesktop/Exception/DuplicateParameterException.h" />
-    <Header path="../../MgDesktop/Exception/DwfException.h" />
-    <Header path="../../MgDesktop/Exception/DwfSectionNotFoundException.h" />
-    <Header path="../../MgDesktop/Exception/DwfSectionResourceNotFoundException.h" />
-    <Header path="../../MgDesktop/Exception/InvalidDwfPackageException.h" />
-    <Header path="../../MgDesktop/Exception/InvalidDwfSectionException.h" />
-    <Header path="../../MgDesktop/Exception/InvalidFeatureSourceException.h" />
-    <Header path="../../MgDesktop/Exception/InvalidLogEntryException.h" />
-    <Header path="../../MgDesktop/Exception/InvalidPrintLayoutFontSizeUnitsException.h" />
-    <Header path="../../MgDesktop/Exception/InvalidPrintLayoutPositionUnitsException.h" />
-    <Header path="../../MgDesktop/Exception/InvalidPrintLayoutSizeUnitsException.h" />
-    <Header path="../../MgDesktop/Exception/ParameterNotFoundException.h" />
-    <Header path="../../MgDesktop/Exception/StylizeLayerFailedException.h" />
 
     <Header path="../../MgDesktop/Services/DataReader.h" />
     <Header path="../../MgDesktop/Services/DrawingService.h" />
@@ -388,6 +292,7 @@
     <Header path="../../MgDesktop/Services/Rendering/RenderingOptions.h" />
 
     <Header path="../../MgDesktop/System/PlatformInit.h" />
+    <Header path="../../MgDesktop/System/ExceptionCodes.h" />
 
     <Header path="../../MgDesktop/MapLayer/Layer.h" />
     <Header path="../../MgDesktop/MapLayer/Map.h" />

Modified: sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/catchall.code
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/catchall.code	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/DesktopUnmanagedApi/catchall.code	2020-10-22 15:43:37 UTC (rev 9749)
@@ -3,6 +3,6 @@
 {
     string s = proxyfname;
     wstring fname = MgUtil::MultiByteToWideChar(s);
-    MgUnclassifiedException* e = new MgUnclassifiedException(fname, __LINE__, __WFILE__, NULL, L"", NULL);
+    MgException* e = new MgException(MgExceptionCodes::MgUnclassifiedException, fname, __LINE__, __WFILE__, nullptr, L"", nullptr);
     ThrowDotNetExceptionWrapper(e);
 }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Log/LogManager.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Log/LogManager.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Log/LogManager.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -330,7 +330,7 @@
 {
     if (filename.empty())
     {
-        throw new MgNullArgumentException(L"MgdLogManager.ValidateLogFileName", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdLogManager.ValidateLogFileName", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     if (STRING::npos != filename.find(L"\\") ||
         STRING::npos != filename.find(L"/"))
@@ -343,7 +343,7 @@
         MgStringCollection whyArguments;
         whyArguments.Add(L"\\/");
 
-        throw new MgInvalidArgumentException(L"MgdLogManager.ValidateLogFileName",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdLogManager.ValidateLogFileName",
             __LINE__, __WFILE__, &arguments, L"MgStringContainsReservedCharacters", &whyArguments);
     }
 
@@ -1992,7 +1992,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(m_path);
-        throw new MgFileIoException(L"MgdLogManager.EnumerateLogs", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFileIoException, L"MgdLogManager.EnumerateLogs", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     dirent* direntry = NULL;
@@ -2071,7 +2071,7 @@
 {
     if (oldFileName.empty() || newFileName.empty())
     {
-        throw new MgNullArgumentException(L"MgdLogManager.RenameLog", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdLogManager.RenameLog", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_LOGMANAGER_TRY()
@@ -2100,7 +2100,7 @@
 {
     if (fileName.empty())
     {
-        throw new MgNullArgumentException(L"MgdLogManager.DeleteLog", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdLogManager.DeleteLog", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     if (STRING::npos != fileName.find(L"\\") ||
@@ -2113,7 +2113,7 @@
         MgStringCollection whyArguments;
         whyArguments.Add(L"\\/");
 
-        throw new MgInvalidArgumentException(L"MgdLogManager.DeleteLog",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdLogManager.DeleteLog",
             __LINE__, __WFILE__, &arguments, L"MgStringContainsReservedCharacters", &whyArguments);
     }
 
@@ -2173,7 +2173,7 @@
             arguments.Add(L"Failed to queue ACE_Message_Block.");
             messageId = L"MgFormatInnerExceptionMessage";
 
-            MgException* mgException = new MgRuntimeException(L"MgdLogManager.QueueLogEntry", __LINE__, __WFILE__, NULL, messageId, &arguments);
+            MgException* mgException = new MgException(MgExceptionCodes::MgRuntimeException, L"MgdLogManager.QueueLogEntry", __LINE__, __WFILE__, NULL, messageId, &arguments);
             throw mgException;
         }
     }
@@ -2314,7 +2314,7 @@
                 arguments.Add(L"1");
                 arguments.Add(buffer);
 
-                throw new MgInvalidArgumentException(L"MgdLogManager.WriteLogMessage",
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdLogManager.WriteLogMessage",
                     __LINE__, __WFILE__, &arguments, L"MgInvalidLogType", NULL);
             }
         }
@@ -2346,7 +2346,7 @@
                 {
                     MgStringCollection arguments;
                     arguments.Add(filename);
-                    throw new MgFileIoException(L"MgdLogManager.WriteLogMessage", __LINE__, __WFILE__, &arguments, L"", NULL);
+                    throw new MgException(MgExceptionCodes::MgFileIoException, L"MgdLogManager.WriteLogMessage", __LINE__, __WFILE__, &arguments, L"", NULL);
                 }
 
                 LogToOStream(pAce, pLogStream);
@@ -2473,7 +2473,7 @@
             arguments.Add(L"1");
             arguments.Add(buffer);
 
-            throw new MgInvalidArgumentException(L"MgdLogManager.GetLogHeader",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdLogManager.GetLogHeader",
                 __LINE__, __WFILE__, &arguments, L"MgInvalidLogType", NULL);
         }
     }
@@ -2561,7 +2561,7 @@
         if (buffer == NULL)
         {
             ACE_OS::fclose(pReadFile);
-            throw new MgOutOfMemoryException(L"MgdLogManager.GetLogContents", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgdLogManager.GetLogContents", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         // Clear buffer
@@ -2608,7 +2608,7 @@
 
     if (numEntries < 0)
     {
-        throw new  MgArgumentOutOfRangeException(L"MgdLogManager.GetLogContents", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgArgumentOutOfRangeException, L"MgdLogManager.GetLogContents", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     INT32 lastPos;      // Keeps track of the position in the file
@@ -2723,7 +2723,7 @@
 
     if (fromDate == NULL || toDate == NULL)
     {
-        throw new MgNullArgumentException(L"MgdLogManager.GetLogContents", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdLogManager.GetLogContents", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     if (*fromDate > *toDate)
@@ -2732,7 +2732,7 @@
         arguments.Add(L"2");
         arguments.Add(fromDate->ToString());
 
-        throw new MgInvalidArgumentException(L"MgdLogManager.GetLogContents",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdLogManager.GetLogContents",
             __LINE__, __WFILE__, &arguments, L"MgInvalidFromDate", NULL);
     }
 
@@ -2744,7 +2744,7 @@
         arguments.Add(L"3");
         arguments.Add(toDate->ToString());
 
-        throw new MgInvalidArgumentException(L"MgdLogManager.GetLogContents",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdLogManager.GetLogContents",
             __LINE__, __WFILE__, &arguments, L"MgInvalidDateDifference", NULL);
     }
 
@@ -2772,7 +2772,7 @@
         arguments.Add(L"3");
         arguments.Add(toDate->ToString());
 
-        throw new MgInvalidArgumentException(L"MgdLogManager.GetLogContents",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdLogManager.GetLogContents",
              __LINE__, __WFILE__, &arguments, L"MgFailedToGetFileNameForDates", NULL);
     }
 
@@ -2779,7 +2779,7 @@
     entries = new MgStringCollection();
     if (entries == NULL)
     {
-        throw new MgOutOfMemoryException(L"MgdLogManager.GetLogContents", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgdLogManager.GetLogContents", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     bool fromDateFound = false;
@@ -2944,7 +2944,7 @@
 
     if (filenames == NULL)
     {
-        throw new MgOutOfMemoryException(L"MgdLogManager.GetLogContents", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgdLogManager.GetLogContents", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     STRING rawFilename;
@@ -2983,7 +2983,7 @@
             arguments.Add(L"1");
             arguments.Add(buffer);
 
-            throw new MgInvalidArgumentException(L"MgdLogManager.DeterminePotentialFileNames",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdLogManager.DeterminePotentialFileNames",
                 __LINE__, __WFILE__, &arguments, L"MgInvalidLogType", NULL);
         }
     }
@@ -3104,7 +3104,7 @@
 
     if (lines == NULL || searchDate == NULL)
     {
-        throw new MgNullArgumentException(L"MgdLogManager.SearchClosestDateAfter", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdLogManager.SearchClosestDateAfter", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     Ptr<MgDateTime> dateTime;
@@ -3184,7 +3184,7 @@
 
     if (lines == NULL || searchDate == NULL)
     {
-        throw new MgNullArgumentException(L"MgdLogManager.SearchClosestDateBefore", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdLogManager.SearchClosestDateBefore", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     Ptr<MgDateTime> dateTime;
@@ -3274,7 +3274,7 @@
     // is enclosed by angle brackets, i.e. <CCYY-MM-DDThh:mm:ss>
     if (entry.find_first_of(L'<') != 0  || entry.find_first_of(L'>') != 20)
     {
-        throw new MgdInvalidLogEntryException(
+        throw new MgException(MgExceptionCodes::MgInvalidLogEntryException, 
             L"MgdLogManager.GetDateTimeFromEntry",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
@@ -3491,7 +3491,7 @@
                 arguments.Add(L"1");
                 arguments.Add(buffer);
 
-                throw new MgInvalidArgumentException(L"MgdLogManager.ArchiveLog",
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdLogManager.ArchiveLog",
                     __LINE__, __WFILE__, &arguments, L"MgInvalidLogType", NULL);
             }
     }
@@ -3627,7 +3627,7 @@
                 arguments.Add(L"1");
                 arguments.Add(buffer);
 
-                throw new MgInvalidArgumentException(L"MgdLogManager.ValidateLogHeaders",
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdLogManager.ValidateLogHeaders",
                     __LINE__, __WFILE__, &arguments, L"MgInvalidLogType", NULL);
             }
     }
@@ -3956,7 +3956,7 @@
         arguments.Add(L"2");
         arguments.Add(logFileType);
 
-        throw new MgInvalidArgumentException(L"MgdLogManager.DetermineLogFileStatus",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdLogManager.DetermineLogFileStatus",
             __LINE__, __WFILE__, &arguments, L"MgInvalidLogType", NULL);
     }
 
@@ -4086,7 +4086,7 @@
             arguments.Add(L"1");
             arguments.Add(buffer);
 
-            throw new MgInvalidArgumentException(L"MgdLogManager.CheckArchiveFrequency",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdLogManager.CheckArchiveFrequency",
                 __LINE__, __WFILE__, &arguments, L"MgInvalidLogType", NULL);
         }
     }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Log/LogThread.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Log/LogThread.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Log/LogThread.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -118,7 +118,7 @@
                             //MgServerManager* pServerManager = MgServerManager::GetInstance();
                             //STRING locale = pServerManager->GetDefaultMessageLocale();
                             STRING locale = MgResources::DefaultMessageLocale;
-                            mgException = new MgFdoException(L"MgdLogThread.svc", __LINE__, __WFILE__, NULL, messageId, &arguments);
+                            mgException = new MgException(MgExceptionCodes::MgFdoException, L"MgdLogThread.svc", __LINE__, __WFILE__, NULL, messageId, &arguments);
                             ACE_DEBUG ((LM_ERROR, ACE_TEXT("(%t) %W\n"), mgException->GetDetails(locale).c_str()));
                             MG_LOG_EXCEPTION_ENTRY(mgException->GetExceptionMessage(locale).c_str(), mgException->GetStackTrace(locale).c_str());
 
@@ -130,7 +130,7 @@
                             //STRING locale = pServerManager->GetDefaultMessageLocale();
                             STRING locale = MgResources::DefaultMessageLocale;
 
-                            mgException = MgSystemException::Create(e, L"MgdLogThread.svc", __LINE__, __WFILE__);
+                            mgException = MgException::Create(e, L"MgdLogThread.svc", __LINE__, __WFILE__);
                             ACE_DEBUG ((LM_ERROR, ACE_TEXT("(%t) %W\n"), mgException->GetDetails(locale).c_str()));
                             MG_LOG_EXCEPTION_ENTRY(mgException->GetExceptionMessage(locale).c_str(), mgException->GetStackTrace(locale).c_str());
                         }
@@ -139,7 +139,7 @@
                             //MgServerManager* pServerManager = MgServerManager::GetInstance();
                             //STRING locale = pServerManager->GetDefaultMessageLocale();
                             STRING locale = MgResources::DefaultMessageLocale;
-                            mgException = new MgUnclassifiedException(L"MgdLogThread.svc", __LINE__, __WFILE__, NULL, L"", NULL);
+                            mgException = new MgException(MgExceptionCodes::MgUnclassifiedException, L"MgdLogThread.svc", __LINE__, __WFILE__, NULL, L"", NULL);
                             ACE_DEBUG ((LM_ERROR, ACE_TEXT("(%t) %W\n"), mgException->GetDetails(locale).c_str()));
                             MG_LOG_EXCEPTION_ENTRY(mgException->GetExceptionMessage(locale).c_str(), mgException->GetStackTrace(locale).c_str());
                         }
@@ -171,7 +171,7 @@
         //STRING locale = pServerManager->GetDefaultMessageLocale();
         STRING locale = MgResources::DefaultMessageLocale;
 
-        mgException = MgSystemException::Create(e, L"MgdLogThread.svc", __LINE__, __WFILE__);
+        mgException = MgException::Create(e, L"MgdLogThread.svc", __LINE__, __WFILE__);
         ACE_DEBUG ((LM_ERROR, ACE_TEXT("(%t) %W\n"), mgException->GetDetails(locale).c_str()));
         MG_LOG_EXCEPTION_ENTRY(mgException->GetExceptionMessage(locale).c_str(), mgException->GetStackTrace(locale).c_str());
 
@@ -183,7 +183,7 @@
         //STRING locale = pServerManager->GetDefaultMessageLocale();
         STRING locale = MgResources::DefaultMessageLocale;
 
-        mgException = new MgUnclassifiedException(L"MgdLogThread.svc", __LINE__, __WFILE__, NULL, L"", NULL);
+        mgException = new MgException(MgExceptionCodes::MgUnclassifiedException, L"MgdLogThread.svc", __LINE__, __WFILE__, NULL, L"", NULL);
         ACE_DEBUG ((LM_ERROR, ACE_TEXT("(%t) %W\n"), mgException->GetDetails(locale).c_str()));
         MG_LOG_EXCEPTION_ENTRY(mgException->GetExceptionMessage(locale).c_str(), mgException->GetStackTrace(locale).c_str());
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Layer.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Layer.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Layer.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -95,7 +95,7 @@
 
     if (NULL == baseMap)
     {
-        throw new MgNullReferenceException(L"MgdLayer.GetMap",
+        throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdLayer.GetMap",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -338,7 +338,7 @@
         MgStringCollection arguments;
         arguments.Add(errorMsg);
         //TODO: MgdInvalidFeatureSourceException
-        throw new MgFeatureServiceException(L"MgdLayer::UpdateFeatures", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdLayer::UpdateFeatures", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     std::unique_ptr<MdfModel::FeatureSource> featureSource;
@@ -366,7 +366,7 @@
 
         if (string::npos == endIndex)
         {
-            throw new MgXmlParserException(L"MgdLayer.UpdateFeatures",
+            throw new MgException(MgExceptionCodes::MgXmlParserException, L"MgdLayer.UpdateFeatures",
                 __LINE__, __WFILE__, NULL, L"", NULL);
         }
         else
@@ -589,7 +589,7 @@
         Ptr<MgDataPropertyDefinition> prop = dynamic_cast<MgDataPropertyDefinition*>(idProps->GetItem(nIds));
         if (0 == (MgDataPropertyDefinition*)prop)
         {
-            throw new MgInvalidCastException(L"MgdLayer.PopulateIdentityProperties",
+            throw new MgException(MgExceptionCodes::MgInvalidCastException, L"MgdLayer.PopulateIdentityProperties",
                 __LINE__, __WFILE__, NULL, L"", NULL);
         }
         MgdLayer::IdProperty idProp;

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Layer.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Layer.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Layer.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_MAP_LAYER_H
 #define DESKTOP_MAP_LAYER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Map.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Map.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Map.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -114,10 +114,10 @@
 void MgdMap::SetDisplaySize(INT32 width, INT32 height)
 {
     if (width <= 0)
-        throw new MgInvalidArgumentException(L"MgdMap::SetDisplaySize", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdMap::SetDisplaySize", __LINE__, __WFILE__, NULL, L"", NULL);
 
     if (height <= 0)
-        throw new MgInvalidArgumentException(L"MgdMap::SetDisplaySize", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdMap::SetDisplaySize", __LINE__, __WFILE__, NULL, L"", NULL);
 
     MgMapBase::SetDisplayHeight(height);
     MgMapBase::SetDisplayWidth(width);
@@ -180,7 +180,7 @@
         STRING errorMsg = parser.GetErrorMessage();
         MgStringCollection arguments;
         arguments.Add(errorMsg);
-        throw new MgInvalidMapDefinitionException(L"MgdMap.Create", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidMapDefinitionException, L"MgdMap.Create", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     // build the runtime map object from the parsed definition
@@ -363,7 +363,7 @@
                 //attach the layer to its group
                 itKg = knownGroups.find(groupName);
                 if(itKg == knownGroups.end())
-                    throw new MgInvalidMapDefinitionException(L"MgdMap.Create", __LINE__, __WFILE__, NULL, L"", NULL);
+                    throw new MgException(MgExceptionCodes::MgInvalidMapDefinitionException, L"MgdMap.Create", __LINE__, __WFILE__, NULL, L"", NULL);
 
                 rtLayer->SetGroup(itKg->second);
             }
@@ -530,7 +530,7 @@
 
     if (NULL == m_resId.p)
     {
-        throw new MgNullReferenceException(L"MgdMap.Save",
+        throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdMap.Save",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -572,7 +572,7 @@
 
     if (NULL == m_resId.p)
     {
-        throw new MgNullReferenceException(L"MgdMap.Save",
+        throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdMap.Save",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -665,7 +665,7 @@
         {
             // If this exception is thrown then the calling code should probably initialize the
             // resource service using SetDelayedLoadResourceService()
-            throw new MgInvalidOperationException(L"MgdMap.UnpackLayersAndGroups", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdMap.UnpackLayersAndGroups", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
 
@@ -894,7 +894,7 @@
 
     if (version != m_serializeVersion)
     {
-        throw new MgStreamIoException(L"MgdMap.Deserialize", __LINE__, __WFILE__, NULL, L"MgInvalidTCPProtocol", NULL);
+        throw new MgException(MgExceptionCodes::MgStreamIoException, L"MgdMap.Deserialize", __LINE__, __WFILE__, NULL, L"MgInvalidTCPProtocol", NULL);
     }
 
     //resource id for MgdMap
@@ -999,7 +999,7 @@
 {
     if (NULL == resourceService)
     {
-        throw new MgNullArgumentException(L"MgdMap.SetDelayedLoadResourceService",
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdMap.SetDelayedLoadResourceService",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Map.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Map.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Map.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_MAP_H
 #define DESKTOP_MAP_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Selection.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Selection.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MapLayer/Selection.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_SELECTION_H
 #define DESKTOP_SELECTION_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MgDesktop.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MgDesktop.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MgDesktop.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 MGDESKTOP_H
 #define MGDESKTOP_H
 
@@ -22,23 +39,8 @@
 #include "System/ClassId.h"
 #include "System/ConfigProperties.h"
 #include "System/PlatformInit.h"
+#include "System/ExceptionCodes.h"
 
-#include "Exception/AliasNotFoundException.h"
-#include "Exception/ConnectionFailedException.h"
-#include "Exception/DuplicateParameterException.h"
-#include "Exception/DwfException.h"
-#include "Exception/DwfSectionNotFoundException.h"
-#include "Exception/DwfSectionResourceNotFoundException.h"
-#include "Exception/InvalidDwfPackageException.h"
-#include "Exception/InvalidDwfSectionException.h"
-#include "Exception/InvalidFeatureSourceException.h"
-#include "Exception/InvalidLogEntryException.h"
-#include "Exception/InvalidPrintLayoutFontSizeUnitsException.h"
-#include "Exception/InvalidPrintLayoutPositionUnitsException.h"
-#include "Exception/InvalidPrintLayoutSizeUnitsException.h"
-#include "Exception/ParameterNotFoundException.h"
-#include "Exception/StylizeLayerFailedException.h"
-
 #include "MapLayer/Layer.h"
 #include "MapLayer/Map.h"
 #include "MapLayer/Selection.h"
@@ -76,7 +78,7 @@
 #include "Services/Resource/UnmanagedDataType.h"
 
 #define NOT_IMPLEMENTED(method) \
-    throw new MgNotImplementedException(method, __LINE__, __WFILE__, NULL, L"", NULL)
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, method, __LINE__, __WFILE__, NULL, L"", NULL)
 
 //Uncomment to debug memory leaks. This is the header for Visual Leak Detector
 //See: http://vld.codeplex.com for download and setup

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MgDesktop.vcxproj
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MgDesktop.vcxproj	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MgDesktop.vcxproj	2020-10-22 15:43:37 UTC (rev 9749)
@@ -226,18 +226,6 @@
     </PostBuildEvent>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ClCompile Include="Exception\AliasNotFoundException.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\InvalidLogEntryException.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-    </ClCompile>
     <ClCompile Include="Log\LogDetail.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -484,12 +472,6 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     </ClCompile>
-    <ClCompile Include="Exception\ConnectionFailedException.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="Services\Rendering\CustomLogoInfo.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -520,30 +502,6 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     </ClCompile>
-    <ClCompile Include="Exception\DuplicateParameterException.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\DwfException.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\DwfSectionNotFoundException.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\DwfSectionResourceNotFoundException.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="Services\Rendering\DwfVersion.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -646,42 +604,6 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     </ClCompile>
-    <ClCompile Include="Exception\InvalidDwfPackageException.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\InvalidDwfSectionException.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\InvalidFeatureSourceException.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\InvalidPrintLayoutFontSizeUnitsException.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\InvalidPrintLayoutPositionUnitsException.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\InvalidPrintLayoutSizeUnitsException.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="Services\Feature\JoinFeatureReader.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -749,10 +671,10 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     </ClCompile>
-    <ClCompile Include="Exception\ParameterNotFoundException.cpp">
+    <ClCompile Include="System\ExceptionCodes.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|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="System\PlatformInit.cpp">
@@ -893,12 +815,6 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     </ClCompile>
-    <ClCompile Include="Exception\StylizeLayerFailedException.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="Services\Tile\TileCache.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -973,13 +889,12 @@
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="Exception\AliasNotFoundException.h" />
-    <ClInclude Include="Exception\InvalidLogEntryException.h" />
     <ClInclude Include="Log\LogDetail.h" />
     <ClInclude Include="Log\LogEntryData.h" />
     <ClInclude Include="Log\LogManager.h" />
     <ClInclude Include="Log\LogThread.h" />
     <ClInclude Include="Log\LogType.h" />
+    <ClInclude Include="ExceptionCodes.h" />
     <ClInclude Include="Services\CryptoDefs.h" />
     <ClInclude Include="Services\Feature\BooleanDataReaderCreator.h" />
     <ClInclude Include="Services\Feature\ByteDataReaderCreator.h" />
@@ -1015,7 +930,6 @@
     <ClInclude Include="Services\Feature\FeatureNumericFunctions.h" />
     <ClInclude Include="Services\Feature\FeatureSetReader.h" />
     <ClInclude Include="Services\Feature\FeatureStringFunctions.h" />
-    <ClInclude Include="Services\Feature\FeautreNumericFunctions.h" />
     <ClInclude Include="Services\Feature\GeometryDataReaderCreator.h" />
     <ClInclude Include="Services\Feature\Int16DataReaderCreator.h" />
     <ClInclude Include="Services\Feature\Int32DataReaderCreator.h" />
@@ -1033,7 +947,6 @@
     <ClInclude Include="Services\Resource\ResourceContentCache.h" />
     <ClInclude Include="System\ClassId.h" />
     <ClInclude Include="System\ConfigProperties.h" />
-    <ClInclude Include="Exception\ConnectionFailedException.h" />
     <ClInclude Include="Services\Rendering\CustomLogoInfo.h" />
     <ClInclude Include="Services\Rendering\CustomTextInfo.h" />
     <ClInclude Include="Services\DataReader.h" />
@@ -1040,10 +953,7 @@
     <ClInclude Include="Services\Drawing\DrawingDefs.h" />
     <ClInclude Include="Services\DrawingService.h" />
     <ClInclude Include="Services\Drawing\DrawingServiceUtil.h" />
-    <ClInclude Include="Exception\DuplicateParameterException.h" />
     <ClInclude Include="Exception\DwfException.h" />
-    <ClInclude Include="Exception\DwfSectionNotFoundException.h" />
-    <ClInclude Include="Exception\DwfSectionResourceNotFoundException.h" />
     <ClInclude Include="Services\Rendering\DwfVersion.h" />
     <ClInclude Include="Services\Feature\FdoConnectionPool.h" />
     <ClInclude Include="Services\Feature\FdoConnectionUtil.h" />
@@ -1063,12 +973,6 @@
     <ClInclude Include="Services\Feature\GwsFeatureReader.h" />
     <ClInclude Include="Services\Rendering\icons.h" />
     <ClInclude Include="Services\ImageFormats.h" />
-    <ClInclude Include="Exception\InvalidDwfPackageException.h" />
-    <ClInclude Include="Exception\InvalidDwfSectionException.h" />
-    <ClInclude Include="Exception\InvalidFeatureSourceException.h" />
-    <ClInclude Include="Exception\InvalidPrintLayoutFontSizeUnitsException.h" />
-    <ClInclude Include="Exception\InvalidPrintLayoutPositionUnitsException.h" />
-    <ClInclude Include="Exception\InvalidPrintLayoutSizeUnitsException.h" />
     <ClInclude Include="Services\Feature\JoinFeatureReader.h" />
     <ClInclude Include="MapLayer\Layer.h" />
     <ClInclude Include="Services\Rendering\Layout.h" />
@@ -1081,6 +985,7 @@
     <ClInclude Include="Services\Rendering\MapPlotInstruction.h" />
     <ClInclude Include="Services\Feature\MgCSTrans.h" />
     <ClInclude Include="MgDesktop.h" />
+    <ClInclude Include="System\ExceptionCodes.h" />
     <ClInclude Include="System\Mutex.h" />
     <ClInclude Include="Services\Resource\OperationInfo.h" />
     <ClInclude Include="Services\Resource\OperationParameter.h" />

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MgDesktop.vcxproj.filters
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MgDesktop.vcxproj.filters	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MgDesktop.vcxproj.filters	2020-10-22 15:43:37 UTC (rev 9749)
@@ -15,9 +15,6 @@
     </Filter>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="Exception\AliasNotFoundException.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="Services\Resource\ByteSourceDwfInputStreamImpl.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -27,9 +24,6 @@
     <ClCompile Include="System\ConfigProperties.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="Exception\ConnectionFailedException.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="Services\Rendering\CustomLogoInfo.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -45,18 +39,6 @@
     <ClCompile Include="Services\Drawing\DrawingServiceUtil.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="Exception\DuplicateParameterException.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\DwfException.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\DwfSectionNotFoundException.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\DwfSectionResourceNotFoundException.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="Services\Rendering\DwfVersion.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -108,24 +90,6 @@
     <ClCompile Include="Services\ImageFormats.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="Exception\InvalidDwfPackageException.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\InvalidDwfSectionException.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\InvalidFeatureSourceException.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\InvalidPrintLayoutFontSizeUnitsException.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\InvalidPrintLayoutPositionUnitsException.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="Exception\InvalidPrintLayoutSizeUnitsException.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="Services\Feature\JoinFeatureReader.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -162,9 +126,6 @@
     <ClCompile Include="Services\Resource\OperationParameter.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="Exception\ParameterNotFoundException.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="System\PlatformInit.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -234,9 +195,6 @@
     <ClCompile Include="Services\SqlReader.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="Exception\StylizeLayerFailedException.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="Services\Tile\TileCache.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -288,9 +246,6 @@
     <ClCompile Include="Services\Feature\ProxyDataReader.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="Exception\InvalidLogEntryException.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="Log\LogDetail.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -390,11 +345,11 @@
     <ClCompile Include="Services\Resource\ResourceContentCache.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="System\ExceptionCodes.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="Exception\AliasNotFoundException.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="Services\Resource\ByteSourceDwfInputStreamImpl.h">
       <Filter>Header Files</Filter>
     </ClInclude>
@@ -407,9 +362,6 @@
     <ClInclude Include="System\ConfigProperties.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="Exception\ConnectionFailedException.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="Services\Rendering\CustomLogoInfo.h">
       <Filter>Header Files</Filter>
     </ClInclude>
@@ -428,18 +380,9 @@
     <ClInclude Include="Services\Drawing\DrawingServiceUtil.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="Exception\DuplicateParameterException.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="Exception\DwfException.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="Exception\DwfSectionNotFoundException.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Exception\DwfSectionResourceNotFoundException.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="Services\Rendering\DwfVersion.h">
       <Filter>Header Files</Filter>
     </ClInclude>
@@ -497,24 +440,6 @@
     <ClInclude Include="Services\ImageFormats.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="Exception\InvalidDwfPackageException.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Exception\InvalidDwfSectionException.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Exception\InvalidFeatureSourceException.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Exception\InvalidPrintLayoutFontSizeUnitsException.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Exception\InvalidPrintLayoutPositionUnitsException.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Exception\InvalidPrintLayoutSizeUnitsException.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="Services\Feature\JoinFeatureReader.h">
       <Filter>Header Files</Filter>
     </ClInclude>
@@ -701,9 +626,6 @@
     <ClInclude Include="Services\Feature\FeatureStringFunctions.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="Services\Feature\FeautreNumericFunctions.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="Services\Feature\GeometryDataReaderCreator.h">
       <Filter>Header Files</Filter>
     </ClInclude>
@@ -731,9 +653,6 @@
     <ClInclude Include="Services\Feature\Matrix.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="Exception\InvalidLogEntryException.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="Log\LogType.h">
       <Filter>Header Files</Filter>
     </ClInclude>
@@ -839,6 +758,12 @@
     <ClInclude Include="Services\Resource\ResourceContentCache.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="ExceptionCodes.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="System\ExceptionCodes.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="Platform.ini" />

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MgDesktopBuild.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MgDesktopBuild.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/MgDesktopBuild.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,24 +1,26 @@
+//
+//  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 "System/ConfigProperties.cpp"
+#include "System/ExceptionCodes.cpp"
 #include "System/PlatformInit.cpp"
 #include "System/TimerUtil.cpp"
 #include "System/ThreadBase.cpp"
 
-#include "Exception/AliasNotFoundException.cpp"
-#include "Exception/ConnectionFailedException.cpp"
-#include "Exception/DuplicateParameterException.cpp"
-#include "Exception/DwfException.cpp"
-#include "Exception/DwfSectionNotFoundException.cpp"
-#include "Exception/DwfSectionResourceNotFoundException.cpp"
-#include "Exception/InvalidDwfPackageException.cpp"
-#include "Exception/InvalidDwfSectionException.cpp"
-#include "Exception/InvalidFeatureSourceException.cpp"
-#include "Exception/InvalidLogEntryException.cpp"
-#include "Exception/InvalidPrintLayoutFontSizeUnitsException.cpp"
-#include "Exception/InvalidPrintLayoutPositionUnitsException.cpp"
-#include "Exception/InvalidPrintLayoutSizeUnitsException.cpp"
-#include "Exception/ParameterNotFoundException.cpp"
-#include "Exception/StylizeLayerFailedException.cpp"
-
 #include "Log/LogDetail.cpp"
 #include "Log/LogEntryData.cpp"
 #include "Log/LogManager.cpp"

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ByteSourceRasterStreamImpl.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ByteSourceRasterStreamImpl.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ByteSourceRasterStreamImpl.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -30,7 +30,7 @@
 {
     if (stream == NULL)
     {
-        throw new MgNullReferenceException(L"ByteSourceRasterStreamImpl", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullReferenceException, L"ByteSourceRasterStreamImpl", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     m_stream = FDO_SAFE_ADDREF(stream);
 }
@@ -62,7 +62,7 @@
 {
     if (buffer == NULL)
     {
-        throw new MgNullArgumentException(L"ByteSourceRasterStreamImpl.Read", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"ByteSourceRasterStreamImpl.Read", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     if (length < 0)
@@ -74,7 +74,7 @@
         arguments.Add(L"2");
         arguments.Add(buffer);
 
-        throw new MgInvalidArgumentException(L"ByteSourceRasterStreamImpl.Read",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"ByteSourceRasterStreamImpl.Read",
             __LINE__, __WFILE__, &arguments, L"MgValueCannotBeLessThanZero", NULL);
     }
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/CryptoDefs.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/CryptoDefs.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/CryptoDefs.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_CRYPTO_DEFS_H
 #define DESKTOP_CRYPTO_DEFS_H
 
@@ -23,27 +40,27 @@
                 break;                                                        \
                                                                               \
             case ecInvalidOperation:                                          \
-                cryptographyException = new MgInvalidOperationException(      \
+                cryptographyException = new MgException(MgExceptionCodes::MgInvalidOperationException,       \
                     methodName, __LINE__, __WFILE__, NULL, L"", NULL);        \
                 break;                                                        \
                                                                               \
             case ecNullArgument:                                              \
-                cryptographyException = new MgNullArgumentException(          \
+                cryptographyException = new MgException(MgExceptionCodes::MgNullArgumentException,           \
                     methodName, __LINE__, __WFILE__, NULL, L"", NULL);        \
                 break;                                                        \
                                                                               \
             case ecInvalidArgument:                                           \
-                cryptographyException = new MgInvalidArgumentException(       \
+                cryptographyException = new MgException(MgExceptionCodes::MgInvalidArgumentException,        \
                     methodName, __LINE__, __WFILE__, NULL, L"", NULL);        \
                 break;                                                        \
                                                                               \
             case ecLengthError:                                               \
-                cryptographyException = new MgLengthException(                \
+                cryptographyException = new MgException(MgExceptionCodes::MgLengthException,                 \
                     methodName, __LINE__, __WFILE__, NULL, L"", NULL);        \
                 break;                                                        \
                                                                               \
             case ecDateTimeError:                                             \
-                cryptographyException = new MgDateTimeException(              \
+                cryptographyException = new MgException(MgExceptionCodes::MgDateTimeException,               \
                     methodName, __LINE__, __WFILE__, NULL, L"", NULL);        \
                 break;                                                        \
                                                                               \
@@ -50,23 +67,23 @@
             case ecFileIoError:                                               \
             case ecReadError:                                                 \
             case ecWriteError:                                                \
-                cryptographyException = new MgFileIoException(                \
+                cryptographyException = new MgException(MgExceptionCodes::MgFileIoException,                 \
                     methodName, __LINE__, __WFILE__, NULL, L"", NULL);        \
                 break;                                                        \
                                                                               \
             case ecEncryptionError:                                           \
-                cryptographyException = new MgEncryptionException(            \
+                cryptographyException = new MgException(MgExceptionCodes::MgEncryptionException,             \
                     methodName, __LINE__, __WFILE__, NULL, L"", NULL);        \
                 break;                                                        \
                                                                               \
             case ecDecryptionError:                                           \
-                cryptographyException = new MgDecryptionException(            \
+                cryptographyException = new MgException(MgExceptionCodes::MgDecryptionException,             \
                     methodName, __LINE__, __WFILE__, NULL, L"", NULL);        \
                 break;                                                        \
                                                                               \
             case ecUnclassified:                                              \
             default:                                                          \
-                cryptographyException = new MgUnclassifiedException(          \
+                cryptographyException = new MgException(MgExceptionCodes::MgUnclassifiedException,           \
                     methodName, __LINE__, __WFILE__, NULL, L"", NULL);        \
                 break;                                                        \
         }                                                                     \
@@ -79,12 +96,12 @@
     }                                                                         \
     catch (exception& e)                                                      \
     {                                                                         \
-        cryptographyException = MgSystemException::Create(                    \
+        cryptographyException = MgException::Create(                    \
             e, methodName, __LINE__, __WFILE__);                              \
     }                                                                         \
     catch (...)                                                               \
     {                                                                         \
-        cryptographyException = new MgUnclassifiedException(                  \
+        cryptographyException = new MgException(MgExceptionCodes::MgUnclassifiedException,                   \
             methodName, __LINE__, __WFILE__, NULL, L"", NULL);                \
     }                                                                         \
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/DataReader.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/DataReader.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/DataReader.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "DataReader.h"
 #include "Services/Feature/FeatureDefs.h"
 #include "Services/Feature/FeatureConnection.h"
@@ -70,7 +87,7 @@
             FdoDataType dataType = m_reader->GetDataType(propertyName.c_str());
             if (FdoDataType(-1) == dataType)
             {
-                throw new MgInvalidPropertyTypeException(L"MgdDataReader.GetPropertyType",
+                throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, L"MgdDataReader.GetPropertyType",
                     __LINE__, __WFILE__, NULL, L"", NULL);
             }
 
@@ -84,7 +101,7 @@
         }
         default:
         {
-            throw new MgInvalidPropertyTypeException(L"MgdDataReader.GetPropertyType",
+            throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, L"MgdDataReader.GetPropertyType",
                 __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
@@ -127,7 +144,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdDataReader::GetBoolean",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdDataReader::GetBoolean",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -152,7 +169,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdDataReader::GetByte",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdDataReader::GetByte",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -179,7 +196,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdDataReader::GetDateTime",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdDataReader::GetDateTime",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -204,7 +221,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdDataReader::GetSingle",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdDataReader::GetSingle",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -229,7 +246,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdDataReader::GetDouble",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdDataReader::GetDouble",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -254,7 +271,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdDataReader::GetInt16",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdDataReader::GetInt16",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -279,7 +296,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdDataReader::GetInt32",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdDataReader::GetInt32",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -304,7 +321,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdDataReader::GetInt64",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdDataReader::GetInt64",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -334,7 +351,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdDataReader::GetString",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdDataReader::GetString",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -409,7 +426,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdDataReader::GetGeometry",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdDataReader::GetGeometry",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -461,7 +478,7 @@
     {
         // TODO: specify which argument and message, once we have the mechanism
         STRING message = MgdFeatureUtil::GetMessage(L"MgMissingRasterProperty");
-        throw new MgInvalidOperationException(L"MgdDataReader::GetRaster",
+        throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdDataReader::GetRaster",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
     byteReader = MgdFeatureUtil::GetRaster(m_reader, rasterPropName, xSize, ySize);
@@ -666,7 +683,7 @@
 
 MgByteReader* MgdDataReader::ToXml() 
 { 
-    throw new MgNotImplementedException(L"MgdDataReader::ToXml", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgdDataReader::ToXml", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 //INTERNAL_API:
@@ -700,7 +717,7 @@
         MgStringCollection arguments;
         arguments.Add(propertyName);
 
-        throw new MgNullPropertyValueException(L"MgdDataReader::GetString",
+        throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdDataReader::GetString",
             __LINE__, __WFILE__, &arguments, L"", NULL);
     }
     else
@@ -720,10 +737,10 @@
 
 void MgdDataReader::Serialize(MgStream* stream) 
 { 
-    throw new MgNotImplementedException(L"MgdDataReader::Serialize", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgdDataReader::Serialize", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 void MgdDataReader::Deserialize(MgStream* stream) 
 { 
-    throw new MgNotImplementedException(L"MgdDataReader::Deserialize", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgdDataReader::Deserialize", __LINE__, __WFILE__, NULL, L"", NULL);
 }
\ No newline at end of file

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/DataReader.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/DataReader.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/DataReader.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_DATA_READER_H
 #define DESKTOP_DATA_READER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Drawing/DrawingDefs.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Drawing/DrawingDefs.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Drawing/DrawingDefs.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_DRAWING_DEFS_H
 #define DESKTOP_DRAWING_DEFS_H
 
@@ -15,7 +32,7 @@
     {                                                                         \
         MgStringCollection arguments;                                         \
         arguments.Add(STRING(e.message()));                                   \
-        mgException = new MgdDwfException(methodName, __LINE__, __WFILE__, NULL, L"MgFormatInnerExceptionMessage", &arguments); \
+        mgException = new MgException(MgExceptionCodes::MgDwfException, methodName, __LINE__, __WFILE__, NULL, L"MgFormatInnerExceptionMessage", &arguments); \
                                                                               \
     MG_CATCH(methodName)                                                      \
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Drawing/DrawingServiceUtil.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Drawing/DrawingServiceUtil.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Drawing/DrawingServiceUtil.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MgDesktop.h"
 #include "DrawingServiceUtil.h"
 #include "DrawingDefs.h"
@@ -289,7 +306,7 @@
 
     if (resourceService == 0)
     {
-        throw new MgServiceNotAvailableException(L"MgdDrawingServiceUtil.OpenDrawingResource", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"MgdDrawingServiceUtil.OpenDrawingResource", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     byteReader = resourceService->GetResourceContent(resource, L"Substitution");
@@ -329,7 +346,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(dwfFileName);
-        throw new MgdInvalidDwfPackageException(L"MgdDrawingServiceUtil.OpenDrawingResource", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidDwfPackageException, L"MgdDrawingServiceUtil.OpenDrawingResource", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     MG_SERVER_DRAWING_SERVICE_CATCH_AND_THROW(L"MgdDrawingServiceUtil.OpenDrawingResource")
@@ -390,7 +407,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(X2W(e.getMessage()));
-        throw new MgXmlParserException(L"MgdDrawingServiceUtil.ParseDrawingResourceContent",
+        throw new MgException(MgExceptionCodes::MgXmlParserException, L"MgdDrawingServiceUtil.ParseDrawingResourceContent",
             __LINE__, __WFILE__, NULL, L"MgFormatInnerExceptionMessage", &arguments);
     }
     catch (const DOMException& e)
@@ -397,12 +414,12 @@
     {
         MgStringCollection arguments;
         arguments.Add(X2W(e.msg));
-        throw new MgXmlParserException(L"MgdDrawingServiceUtil.ParseDrawingResourceContent",
+        throw new MgException(MgExceptionCodes::MgXmlParserException, L"MgdDrawingServiceUtil.ParseDrawingResourceContent",
             __LINE__, __WFILE__, NULL, L"MgFormatInnerExceptionMessage", &arguments);
     }
     catch (...)
     {
-        throw new MgUnclassifiedException(L"MgdDrawingServiceUtil.ParseDrawingResourceContent",
+        throw new MgException(MgExceptionCodes::MgUnclassifiedException, L"MgdDrawingServiceUtil.ParseDrawingResourceContent",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
 }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Drawing/DrawingServiceUtil.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Drawing/DrawingServiceUtil.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Drawing/DrawingServiceUtil.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_DRAWING_SERVICE_UTIL_H
 #define DESKTOP_DRAWING_SERVICE_UTIL_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/DrawingService.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/DrawingService.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/DrawingService.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "DrawingService.h"
 #include "ServiceFactory.h"
 #include "Services/Drawing/DrawingDefs.h"
@@ -41,7 +58,7 @@
 
     if (0 == resource)
     {
-        throw new MgNullArgumentException(L"MgdDrawingService.GetDrawing", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdDrawingService.GetDrawing", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     // Get the name of the dwf file from the resource content and remove the path from the filename
@@ -110,7 +127,7 @@
 
     if (0 == resource)
     {
-        throw new MgNullArgumentException(L"MgdDrawingService.DescribeDrawing", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdDrawingService.DescribeDrawing", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     else
     {
@@ -140,7 +157,7 @@
                 DWFCORE_FREE_OBJECT(pStream);
             if (0 != pBuffer)
                 DWFCORE_FREE_MEMORY(pBuffer);
-            throw new MgInvalidCastException(L"MgdDrawingService.DescribeDrawing", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidCastException, L"MgdDrawingService.DescribeDrawing", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         // Return the manifest via a MgByteReader
@@ -222,7 +239,7 @@
 
     if (0 == resource)
     {
-        throw new MgNullArgumentException(L"MgdDrawingService.GetSection", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdDrawingService.GetSection", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     else if (sectionName.empty())
     {
@@ -230,7 +247,7 @@
         arguments.Add(L"2");
         arguments.Add(MgResources::BlankArgument);
 
-        throw new MgInvalidArgumentException(L"MgdDrawingService.GetSection",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdDrawingService.GetSection",
             __LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
     }
     else
@@ -244,7 +261,7 @@
         {
             MgStringCollection arguments;
             arguments.Add(sectionName);
-            throw new MgdDwfSectionNotFoundException(L"MgdDrawingService.GetSection", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgDwfSectionNotFoundException, L"MgdDrawingService.GetSection", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
 
         // Create a DWFPackageWriter for writing the section to a temporary DWF file
@@ -350,7 +367,7 @@
 
     if (0 == resource)
     {
-        throw new MgNullArgumentException(L"MgdDrawingService.GetSectionResource", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdDrawingService.GetSectionResource", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     else if (resourceName.empty())
     {
@@ -358,7 +375,7 @@
         arguments.Add(L"2");
         arguments.Add(MgResources::BlankArgument);
 
-        throw new MgInvalidArgumentException(L"MgdDrawingService.GetSectionResource",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdDrawingService.GetSectionResource",
             __LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
     }
     else
@@ -374,7 +391,7 @@
             arguments.Add(L"2");
             arguments.Add(resourceName);
 
-            throw new MgInvalidArgumentException(L"MgdDrawingService.GetSectionResource",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdDrawingService.GetSectionResource",
                 __LINE__, __WFILE__, &arguments, L"MgResourceNameSeparatorNotFound", NULL);
         }
         sectionName = resourceName.substr(0, index);
@@ -385,7 +402,7 @@
             arguments.Add(L"2");
             arguments.Add(resourceName);
 
-            throw new MgInvalidArgumentException(L"MgdDrawingService.GetSectionResource",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdDrawingService.GetSectionResource",
                 __LINE__, __WFILE__, &arguments, L"MgResourceNameDoesNotContainSectionName", NULL);
         }
 
@@ -396,7 +413,7 @@
         {
             MgStringCollection arguments;
             arguments.Add(sectionName);
-            throw new MgdDwfSectionNotFoundException(L"MgdDrawingService.GetSectionResource", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgDwfSectionNotFoundException, L"MgdDrawingService.GetSectionResource", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         // ...check if the resource exists in the section
         DWFResource* pResource = pSection->findResourceByHREF(resourceName.c_str());
@@ -404,7 +421,7 @@
         {
             MgStringCollection arguments;
             arguments.Add(resourceName);
-            throw new MgdDwfSectionResourceNotFoundException(L"MgdDrawingService.GetSectionResource", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgDwfSectionResourceNotFoundException, L"MgdDrawingService.GetSectionResource", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         // ...get the mime type for the resource
         STRING wsMimeType = (STRING)pResource->mime();
@@ -421,7 +438,7 @@
                 DWFCORE_FREE_OBJECT(pStream);
             if (0 != pBuffer)
                 DWFCORE_FREE_MEMORY(pBuffer);
-            throw new MgInvalidCastException(L"MgdDrawingService.GetSectionResource", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidCastException, L"MgdDrawingService.GetSectionResource", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         // Return the resource via a MgByteReader
@@ -505,7 +522,7 @@
 
     if (0 == resource)
     {
-        throw new MgNullArgumentException(L"MgdDrawingService.EnumerateLayers", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdDrawingService.EnumerateLayers", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     else if (sectionName.empty())
     {
@@ -513,7 +530,7 @@
         arguments.Add(L"2");
         arguments.Add(MgResources::BlankArgument);
 
-        throw new MgInvalidArgumentException(L"MgdDrawingService.EnumerateLayers",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdDrawingService.EnumerateLayers",
             __LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
     }
     else
@@ -527,7 +544,7 @@
         {
             MgStringCollection arguments;
             arguments.Add(sectionName);
-            throw new MgdDwfSectionNotFoundException(L"MgdDrawingService.EnumerateLayers", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgDwfSectionNotFoundException, L"MgdDrawingService.EnumerateLayers", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
 
         // Get the resources for the section
@@ -547,7 +564,7 @@
                 {
                     MgStringCollection arguments;
                     arguments.Add(sectionName);
-                    throw new MgdInvalidDwfSectionException(L"MgdDrawingService.GetSection", __LINE__, __WFILE__, &arguments, L"", NULL);
+                    throw new MgException(MgExceptionCodes::MgInvalidDwfSectionException, L"MgdDrawingService.GetSection", __LINE__, __WFILE__, &arguments, L"", NULL);
                 }
 
                 pResource = piResources->get();
@@ -559,13 +576,13 @@
 
         if (0 == pResource)
         {
-            throw new MgNullReferenceException(L"MgdDrawingService.EnumerateLayers", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdDrawingService.EnumerateLayers", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         DWFInputStream* pStream = pResource->getInputStream();
         if (0 == pStream)
         {
-            throw new MgNullReferenceException(L"MgdDrawingService.EnumerateLayers", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdDrawingService.EnumerateLayers", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         size_t nBytes = pStream->available();
         char* pBuffer = DWFCORE_ALLOC_MEMORY( char, nBytes );
@@ -573,7 +590,7 @@
         DWFCORE_FREE_OBJECT(pStream);
         if (0 == pBuffer)
         {
-            throw new MgNullReferenceException(L"MgdDrawingService.EnumerateLayers", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdDrawingService.EnumerateLayers", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         // Write the memory buffer to a temporary file
@@ -583,7 +600,7 @@
         FILE* fp = fopen( tempW2dFileName.c_str(), "wb+" );  // NOXLATE
         if (0 == fp)
         {
-            throw new MgTemporaryFileNotAvailableException(L"MgdDrawingService.EnumerateLayers", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgTemporaryFileNotAvailableException, L"MgdDrawingService.EnumerateLayers", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         fwrite(pBuffer, sizeof(char), nBytes, fp);
@@ -695,7 +712,7 @@
 
     if (0 == resource)
     {
-        throw new MgNullArgumentException(L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     else if (sectionName.empty())
     {
@@ -703,7 +720,7 @@
         arguments.Add(L"2");
         arguments.Add(MgResources::BlankArgument);
 
-        throw new MgInvalidArgumentException(L"MgdDrawingService.GetLayer",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdDrawingService.GetLayer",
             __LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
     }
     else
@@ -717,7 +734,7 @@
         {
             MgStringCollection arguments;
             arguments.Add(sectionName);
-            throw new MgdDwfSectionNotFoundException(L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgDwfSectionNotFoundException, L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         pSection->readDescriptor();
 
@@ -738,7 +755,7 @@
                 {
                     MgStringCollection arguments;
                     arguments.Add(sectionName);
-                    throw new MgdInvalidDwfSectionException(L"MgdDrawingService.GetSection", __LINE__, __WFILE__, &arguments, L"", NULL);
+                    throw new MgException(MgExceptionCodes::MgInvalidDwfSectionException, L"MgdDrawingService.GetSection", __LINE__, __WFILE__, &arguments, L"", NULL);
                 }
 
                 pResource = piResources->get();
@@ -750,13 +767,13 @@
 
         if (0 == pResource)
         {
-            throw new MgNullReferenceException(L"MgdDrawingService.EnumerateLayers", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdDrawingService.EnumerateLayers", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         DWFInputStream* pStream = pResource->getInputStream();
         if (0 == pStream)
         {
-            throw new MgNullReferenceException(L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         size_t nBytes = pStream->available();
         char* pBuffer = DWFCORE_ALLOC_MEMORY( char, nBytes );
@@ -764,7 +781,7 @@
         DWFCORE_FREE_OBJECT(pStream);
         if (0 == pBuffer)
         {
-            throw new MgNullReferenceException(L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         // Write the memory buffer to a temporary file
@@ -774,7 +791,7 @@
         FILE* fp = fopen( tempW2dFileName.c_str(), "wb+" );  // NOXLATE
         if (0 == fp)
         {
-            throw new MgTemporaryFileNotAvailableException(L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgTemporaryFileNotAvailableException, L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         fwrite(pBuffer, sizeof(char), nBytes, fp);
@@ -846,7 +863,7 @@
             // Cannot find specified layer in the Dwf section
             MgStringCollection arguments;
             arguments.Add(targetLayer.name);
-            throw new MgLayerNotFoundException(L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgLayerNotFoundException, L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
 
         // Use EPlotSection to get section color, paper
@@ -869,7 +886,7 @@
             pPaper) );
         if (0 == pPage)
         {
-            throw new MgOutOfMemoryException(L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         // Set properties for the section
         pPage->provideProperty(
@@ -886,7 +903,7 @@
             L"") );
         if (0 == p2Dgfx)
         {
-            throw new MgOutOfMemoryException(L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         p2Dgfx->configureGraphic(pTransform, pExtents, pClip);
 
@@ -896,7 +913,7 @@
         if (pW2DFile == NULL)
         {
             DWFCORE_FREE_OBJECT( p2Dgfx );
-            throw new MgOutOfMemoryException(L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         DWFFileInputStream* pW2DFilestream = DWFCORE_ALLOC_OBJECT( DWFFileInputStream );
         if (pW2DFilestream == NULL)
@@ -903,7 +920,7 @@
         {
             DWFCORE_FREE_OBJECT( p2Dgfx );
             DWFCORE_FREE_OBJECT( pW2DFile );
-            throw new MgOutOfMemoryException(L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgOutOfMemoryException, L"MgdDrawingService.GetLayer", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         //... open the file and bind it to the stream
         pW2DFile->open();
@@ -1009,7 +1026,7 @@
 
     if (0 == resource)
     {
-        throw new MgNullArgumentException(L"MgdDrawingService.EnumerateSections", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdDrawingService.EnumerateSections", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     else
     {
@@ -1155,7 +1172,7 @@
 
     if (0 == resource)
     {
-        throw new MgNullArgumentException(L"MgdDrawingService.EnumerateSectionResources", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdDrawingService.EnumerateSectionResources", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     else if (sectionName.empty())
     {
@@ -1163,7 +1180,7 @@
         arguments.Add(L"2");
         arguments.Add(MgResources::BlankArgument);
 
-        throw new MgInvalidArgumentException(L"MgdDrawingService.EnumerateSectionResources",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdDrawingService.EnumerateSectionResources",
             __LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
     }
     else
@@ -1177,7 +1194,7 @@
         {
             MgStringCollection arguments;
             arguments.Add(sectionName);
-            throw new MgdDwfSectionNotFoundException(L"MgdDrawingService.EnumerateSectionResources", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgDwfSectionNotFoundException, L"MgdDrawingService.EnumerateSectionResources", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
 
         // Get all the resources in the section
@@ -1187,7 +1204,7 @@
         {
             MgStringCollection arguments;
             arguments.Add(sectionName);
-            throw new MgdInvalidDwfSectionException(L"MgdDrawingService.EnumerateSectionResources", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidDwfSectionException, L"MgdDrawingService.EnumerateSectionResources", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
 
         // Iterate through the resources and write to xml document
@@ -1304,7 +1321,7 @@
 
     if (0 == resource)
     {
-        throw new MgNullArgumentException(L"MgdDrawingService.GetCoordinateSpace", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdDrawingService.GetCoordinateSpace", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     // Get the coordinate space from the resource content.

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/DrawingService.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/DrawingService.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/DrawingService.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_DRAWING_SERVICE_H
 #define DESKTOP_DRAWING_SERVICE_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/ApplySchema.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/ApplySchema.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/ApplySchema.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -39,7 +39,7 @@
 
     if (NULL == resource || NULL == schema)
     {
-        throw new MgNullArgumentException(L"MgdApplySchema.ApplySchema", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdApplySchema.ApplySchema", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     // Connect to provider
@@ -57,7 +57,7 @@
         {
             // TODO: specify which argument and message, once we have the mechanism
             STRING message = MgdFeatureUtil::GetMessage(L"MgCommandNotSupported");
-            throw new MgInvalidOperationException(L"MgdApplySchema.ApplySchema", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdApplySchema.ApplySchema", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         FdoPtr<FdoIDescribeSchema> fdoDecribeSchemaCmd = (FdoIDescribeSchema*) fdoConn->CreateCommand(FdoCommandType_DescribeSchema);

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/CreateFeatureSource.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/CreateFeatureSource.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/CreateFeatureSource.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MgDesktop.h"
 #include "CreateFeatureSource.h"
 #include "Services/Feature/FdoConnectionUtil.h"
@@ -37,7 +54,7 @@
             creator->CreateFeatureSource(false, false);
         }
         else
-            throw new MgInvalidArgumentException(L"MgdCreateFeatureSource.CreateFeatureSource", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdCreateFeatureSource.CreateFeatureSource", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     else if (NULL != rdbParams)
     {
@@ -51,7 +68,7 @@
             creator->CreateFeatureSource();
         }
         else
-            throw new MgInvalidArgumentException(L"MgdCreateFeatureSource.CreateFeatureSource", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdCreateFeatureSource.CreateFeatureSource", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_FEATURE_SERVICE_CHECK_CONNECTION_CATCH_AND_THROW(resource, L"MgdCreateFeatureSource.CreateFeatureSource")
@@ -86,13 +103,13 @@
     //
     Ptr<MgFeatureSchema> schema = m_params->GetFeatureSchema();
     if(schema == NULL)
-        throw new MgInvalidArgumentException(L"MgdCreateFileFeatureSource.CreateFeatureSource", __LINE__, __WFILE__, NULL, L"MgMissingSchema", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdCreateFileFeatureSource.CreateFeatureSource", __LINE__, __WFILE__, NULL, L"MgMissingSchema", NULL);
 
     if (bCheckFeatureClass)
     {
         Ptr<MgClassDefinitionCollection> classes = schema->GetClasses();
         if(classes == NULL || classes->GetCount() == 0)
-            throw new MgInvalidArgumentException(L"MgdCreateFileFeatureSource.CreateFeatureSource", __LINE__, __WFILE__, NULL, L"MgMissingClassDef", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdCreateFileFeatureSource.CreateFeatureSource", __LINE__, __WFILE__, NULL, L"MgMissingClassDef", NULL);
 
         for(INT32 ci = 0; ci < classes->GetCount(); ci++)
         {
@@ -99,7 +116,7 @@
             Ptr<MgClassDefinition> classDef = classes->GetItem(ci);
             Ptr<MgPropertyDefinitionCollection> idProps = classDef->GetIdentityProperties();
             if(idProps == NULL || idProps->GetCount() == 0)
-                throw new MgInvalidArgumentException(L"MgdCreateFileFeatureSource.CreateFeatureSource", __LINE__, __WFILE__, NULL, L"MgClassWOIdentity", NULL);
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdCreateFileFeatureSource.CreateFeatureSource", __LINE__, __WFILE__, NULL, L"MgClassWOIdentity", NULL);
         }
     }
 
@@ -107,7 +124,7 @@
     {
         // A coordinate system must be defined
         if(m_params->GetCoordinateSystemWkt().empty())
-            throw new MgInvalidArgumentException(L"MgdCreateFileFeatureSource.CreateFeatureSource", __LINE__, __WFILE__, NULL, L"MgMissingSrs", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdCreateFileFeatureSource.CreateFeatureSource", __LINE__, __WFILE__, NULL, L"MgMissingSrs", NULL);
     }
 
     // Connect to provider
@@ -119,13 +136,13 @@
     {
         if(NULL == connWrap.p)
         {
-            throw new MgdConnectionFailedException(L"MgdCreateFileFeatureSource.CreateFeatureSource", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdCreateFileFeatureSource.CreateFeatureSource", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         FdoPtr<FdoIConnection> conn = connWrap->GetConnection();
         if (conn == NULL)
         {
-            throw new MgdConnectionFailedException(L"MgdCreateFileFeatureSource.CreateFeatureSource", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdCreateFileFeatureSource.CreateFeatureSource", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         CreateDataStore(conn);
@@ -452,7 +469,7 @@
         //Amend connection string to incorporate the created data store
         conn = new MgdFeatureConnection(provider, connStr);
         if (!conn->IsConnectionOpen())
-            throw new MgdConnectionFailedException(L"MgdCreateRdbmsFeatureSource::CreateFeatureSource", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdCreateRdbmsFeatureSource::CreateFeatureSource", __LINE__, __WFILE__, NULL, L"", NULL);
 
         fdoConn = conn->GetConnection();
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/CreateFeatureSource.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/CreateFeatureSource.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/CreateFeatureSource.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_CREATE_FEATURE_SOURCE_H
 #define DESKTOP_CREATE_FEATURE_SOURCE_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/DescribeSchema.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/DescribeSchema.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/DescribeSchema.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -200,7 +200,7 @@
                     }
                     else
                     {
-                        throw new MgdConnectionFailedException(L"MgdDescribeSchema.DescribeFdoSchema", __LINE__, __WFILE__, NULL, L"", NULL);
+                        throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdDescribeSchema.DescribeFdoSchema", __LINE__, __WFILE__, NULL, L"", NULL);
                     }
                 }
 
@@ -210,7 +210,7 @@
     }
     else
     {
-        throw new MgdConnectionFailedException(L"MgdDescribeSchema.DescribeFdoSchema", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdDescribeSchema.DescribeFdoSchema", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_FEATURE_SERVICE_CHECK_CONNECTION_CATCH_AND_THROW(resource, L"MgdDescribeSchema.DescribeFdoSchema")
@@ -546,7 +546,7 @@
                         }
                         else
                         {
-                            throw new MgdConnectionFailedException(L"MgdDescribeSchema.DescribeSchema", __LINE__, __WFILE__, NULL, L"", NULL);
+                            throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdDescribeSchema.DescribeSchema", __LINE__, __WFILE__, NULL, L"", NULL);
                         }
 
                     }  // end if (NULL != secFeatureSource)
@@ -655,7 +655,7 @@
 
     if (NULL == schema)
     {
-        throw new MgNullArgumentException(L"MgdDescribeSchema.SchemaToXml", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdDescribeSchema.SchemaToXml", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     CHECKNULL((MgFeatureSchemaCollection*)schema, L"MgdDescribeSchema.SchemaToXml");
@@ -679,7 +679,7 @@
 
     if (NULL == schema)
     {
-        throw new MgNullArgumentException(L"MgdDescribeSchema.SchemaToXml", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdDescribeSchema.SchemaToXml", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     CHECKNULL((MgFeatureSchemaCollection*)schema, L"MgdDescribeSchema.SchemaToXml");
@@ -902,7 +902,7 @@
         }
         else
         {
-            throw new MgdConnectionFailedException(L"MgdDescribeSchema.GetSchemas",
+            throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdDescribeSchema.GetSchemas",
                 __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
@@ -1005,7 +1005,7 @@
         }
         else
         {
-            throw new MgdConnectionFailedException(L"MgdDescribeSchema.GetClasses",
+            throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdDescribeSchema.GetClasses",
                 __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
@@ -1035,7 +1035,7 @@
 
     if (className.empty())
     {
-        throw new MgClassNotFoundException(
+        throw new MgException(MgExceptionCodes::MgClassNotFoundException, 
             L"MgdDescribeSchema.GetClassDefinition",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
@@ -1062,7 +1062,7 @@
 
         if (NULL == classDefinition.p)
         {
-            throw new MgClassNotFoundException(
+            throw new MgException(MgExceptionCodes::MgClassNotFoundException, 
                 L"MgdDescribeSchema.GetClassDefinition",
                 __LINE__, __WFILE__, NULL, L"", NULL);
         }
@@ -1094,7 +1094,7 @@
 
     if (NULL == classNames || classNames->GetCount() == 0)
     {
-        throw new MgClassNotFoundException(
+        throw new MgException(MgExceptionCodes::MgClassNotFoundException, 
             L"MgdDescribeSchema.GetIdentityProperties",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
@@ -1217,7 +1217,7 @@
 
     if (NULL == classCol || NULL == idProps)
     {
-        throw new MgNullArgumentException(L"MgdDescribeSchema.GetIdentityProperties",
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdDescribeSchema.GetIdentityProperties",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -1479,7 +1479,7 @@
             args.Add(detail);
 
             mgException = NULL;
-            mgException = new MgFeatureServiceException(L"MgdDescribeSchema.GetIdentityProperties", __LINE__, __WFILE__, NULL, L"MgFeatureSourceFormatInnerExceptionMessage", &args);
+            mgException = new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdDescribeSchema.GetIdentityProperties", __LINE__, __WFILE__, NULL, L"MgFeatureSourceFormatInnerExceptionMessage", &args);
         }
     }
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/EnumerateDataStores.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/EnumerateDataStores.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/EnumerateDataStores.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -86,7 +86,7 @@
     }
     else
     {
-        throw new MgdConnectionFailedException(L"MgdEnumerateDataStores::EnumerateDataStores()", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdEnumerateDataStores::EnumerateDataStores()", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgdEnumerateDataStores.EnumerateDataStores")

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/ExtendedSelectCommand.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/ExtendedSelectCommand.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/ExtendedSelectCommand.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -42,7 +42,7 @@
     }
     else
     {
-        throw new MgdConnectionFailedException(L"MgdExtendedSelectCommand.MgdExtendedSelectCommand", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdExtendedSelectCommand.MgdExtendedSelectCommand", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     // Create FdoIExtendedSelect command
     FdoPtr<FdoIConnection> fdoConn = m_connection->GetConnection();
@@ -68,7 +68,7 @@
     // This operation is not supported by FdoIExtendedSelect
     // m_command->SetDistinct(value);
 
-    // throw new MgInvalidOperationException(L"MgdExtendedSelectCommand.SetDistinct", __LINE__, __WFILE__, NULL, L"", NULL);
+    // throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdExtendedSelectCommand.SetDistinct", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 bool MgdExtendedSelectCommand::GetDistinct()
@@ -77,7 +77,7 @@
     // This operation is not supported by FdoIExtendedSelect
     // return m_command->GetDistinct();
 
-    // throw new MgInvalidOperationException(L"MgdExtendedSelectCommand.GetDistinct", __LINE__, __WFILE__, NULL, L"", NULL);
+    // throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdExtendedSelectCommand.GetDistinct", __LINE__, __WFILE__, NULL, L"", NULL);
 
     return false;
 }
@@ -130,7 +130,7 @@
     // This operation is not supported by FdoIExtendedSelect
     // return m_command->GetGrouping();
 
-    // throw new MgInvalidOperationException(L"MgdExtendedSelectCommand.GetGrouping", __LINE__, __WFILE__, NULL, L"", NULL);
+    // throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdExtendedSelectCommand.GetGrouping", __LINE__, __WFILE__, NULL, L"", NULL);
     return NULL;
 }
 
@@ -140,7 +140,7 @@
     // This operation is not supported by FdoIExtendedSelect
     // m_command->SetGroupingFilter(filter);
 
-    // throw new MgInvalidOperationException(L"MgdExtendedSelectCommand.SetGroupingFilter", __LINE__, __WFILE__, NULL, L"", NULL);
+    // throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdExtendedSelectCommand.SetGroupingFilter", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 FdoFilter* MgdExtendedSelectCommand::GetGroupingFilter()
@@ -149,7 +149,7 @@
     // This operation is not supported by FdoIExtendedSelect
     // return m_command->GetGroupingFilter(filter);
 
-    // throw new MgInvalidOperationException(L"MgdExtendedSelectCommand.GetGroupingFilter", __LINE__, __WFILE__, NULL, L"", NULL);
+    // throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdExtendedSelectCommand.GetGroupingFilter", __LINE__, __WFILE__, NULL, L"", NULL);
     return NULL;
 }
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/ExtendedSelectCommand.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/ExtendedSelectCommand.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/ExtendedSelectCommand.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,6 +1,3 @@
-#ifndef DESKTOP_EXTENDED_SELECT_COMMAND_H
-#define DESKTOP_EXTENDED_SELECT_COMMAND_H
-
 //
 //  Copyright (C) 2004-2011 by Autodesk, Inc.
 //
@@ -18,6 +15,9 @@
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
+#ifndef DESKTOP_EXTENDED_SELECT_COMMAND_H
+#define DESKTOP_EXTENDED_SELECT_COMMAND_H
+
 class MgdFdoFeatureReader;
 class MgdFdoReaderCollection;
 class MgdFdoFilterCollection;

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/FeatureManipulationCommand.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/FeatureManipulationCommand.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/FeatureManipulationCommand.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -72,7 +72,7 @@
 
         MgStringCollection arguments;
         arguments.Add(message);
-        throw new MgFeatureServiceException(L"MgdFeatureManipulationCommand.CreateCommand", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdFeatureManipulationCommand.CreateCommand", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     return command.Detach();

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetConnectionPropertyValues.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetConnectionPropertyValues.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetConnectionPropertyValues.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -44,7 +44,7 @@
         arguments.Add(L"1");
         arguments.Add(MgResources::BlankArgument);
 
-        throw new MgInvalidArgumentException(L"MgdGetConnectionPropertyValues.GetConnectionPropertyValues",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdGetConnectionPropertyValues.GetConnectionPropertyValues",
             __LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
     }
 
@@ -54,7 +54,7 @@
         arguments.Add(L"2");
         arguments.Add(MgResources::BlankArgument);
 
-        throw new MgInvalidArgumentException(L"MgdGetConnectionPropertyValues.GetConnectionPropertyValues",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdGetConnectionPropertyValues.GetConnectionPropertyValues",
             __LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
     }
 
@@ -90,7 +90,7 @@
     {
         if(NULL == msfc.p)
         {
-            throw new MgdConnectionFailedException(L"MgdGetConnectionPropertyValues.GetConnectionPropertyValues", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdGetConnectionPropertyValues.GetConnectionPropertyValues", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         // The reference to the FDO connection from the MgdFeatureConnection object must be cleaned up before the parent object
@@ -113,7 +113,7 @@
             arguments.Add(L"2");
             arguments.Add(propertyName);
 
-            throw new MgInvalidArgumentException(L"MgdGetConnectionPropertyValues.GetConnectionPropertyValues",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdGetConnectionPropertyValues.GetConnectionPropertyValues",
                 __LINE__, __WFILE__, &arguments, L"MgPropertyNotEnumerable", NULL);
         }
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetLongTransactions.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetLongTransactions.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetLongTransactions.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -39,7 +39,7 @@
 
     if (NULL == resId)
     {
-        throw new MgNullArgumentException(L"MgdGetLongTransactions.GetLongTransactions", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdGetLongTransactions.GetLongTransactions", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     // Connect to provider
@@ -58,7 +58,7 @@
         {
             // TODO: specify which argument and message, once we have the mechanism
             STRING message = MgdFeatureUtil::GetMessage(L"MgCommandNotSupported");
-            throw new MgInvalidOperationException(L"MgdGetLongTransactions.GetLongTransactions", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdGetLongTransactions.GetLongTransactions", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         FdoPtr<FdoIGetLongTransactions> fdoCommand = (FdoIGetLongTransactions*)fdoConn->CreateCommand(FdoCommandType_GetLongTransactions);
@@ -96,7 +96,7 @@
     }
     else
     {
-        throw new MgdConnectionFailedException(L"MgdGetLongTransactions::GetLongTransactions()", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdGetLongTransactions::GetLongTransactions()", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_FEATURE_SERVICE_CHECK_CONNECTION_CATCH_AND_THROW(resId, L"MgdGetLongTransactions.GetLongTransactions")

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetProviderCapabilities.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetProviderCapabilities.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetProviderCapabilities.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -46,7 +46,7 @@
         arguments.Add(L"1");
         arguments.Add(MgResources::BlankArgument);
 
-        throw new MgInvalidArgumentException(L"MgdGetProviderCapabilities.MgdGetProviderCapabilities",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdGetProviderCapabilities.MgdGetProviderCapabilities",
             __LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
     }
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetSchemaMapping.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetSchemaMapping.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetSchemaMapping.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -110,7 +110,7 @@
     }
     else
     {
-        throw new MgdConnectionFailedException(L"MgdGetSchemaMapping::GetSchemaMapping()", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdGetSchemaMapping::GetSchemaMapping()", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgdGetSchemaMapping.GetSchemaMapping")

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetSpatialContexts.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetSpatialContexts.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/GetSpatialContexts.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -62,7 +62,7 @@
             {
                 // TODO: specify which argument and message, once we have the mechanism
                 STRING message = MgdFeatureUtil::GetMessage(L"MgCommandNotSupported");
-                throw new MgInvalidOperationException(L"MgdGetSpatialContexts.GetSpatialContexts", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdGetSpatialContexts.GetSpatialContexts", __LINE__, __WFILE__, NULL, L"", NULL);
             }
 
             FdoPtr<FdoIGetSpatialContexts> fdoCommand = (FdoIGetSpatialContexts*)fdoConn->CreateCommand(FdoCommandType_GetSpatialContexts);
@@ -89,7 +89,7 @@
         }
         else
         {
-            throw new MgdConnectionFailedException(L"MgdGetSpatialContexts.GetSpatialContexts()", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdGetSpatialContexts.GetSpatialContexts()", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
     else

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/InsertCommand.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/InsertCommand.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/InsertCommand.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -59,7 +59,7 @@
 
         MgStringCollection arguments;
         arguments.Add(message);
-        throw new MgFeatureServiceException(L"MgdInsertCommand::Execute", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdInsertCommand::Execute", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     FdoPtr<FdoIConnection> fdoConn = m_srvrFeatConn->GetConnection();
@@ -122,7 +122,7 @@
 
         MgStringCollection arguments;
         arguments.Add(message);
-        throw new MgFeatureServiceException(L"MgServerGwsGetFeatures.BatchInsert", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgServerGwsGetFeatures.BatchInsert", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     char buff[32];
@@ -170,7 +170,7 @@
 
             MgStringCollection arguments;
             arguments.Add(message);
-            throw new MgFeatureServiceException(L"MgdInsertCommand.SingleInsert", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdInsertCommand.SingleInsert", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
 
         bool available = false;
@@ -194,7 +194,7 @@
 
             MgStringCollection arguments;
             arguments.Add(message);
-            throw new MgFeatureServiceException(L"MgdInsertCommand.SingleInsert", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdInsertCommand.SingleInsert", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
 
         // Performance improvement: Only return the key values

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/SelectAggregateCommand.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/SelectAggregateCommand.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/SelectAggregateCommand.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -41,7 +41,7 @@
     }
     else
     {
-        throw new MgdConnectionFailedException(L"MgdSelectAggregateCommand.MgdSelectAggregateCommand", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdSelectAggregateCommand.MgdSelectAggregateCommand", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     // Create FdoISelectAggregates command
     FdoPtr<FdoIConnection> fdoConn = m_connection->GetConnection();

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/SelectCommand.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/SelectCommand.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/SelectCommand.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -42,7 +42,7 @@
     }
     else
     {
-        throw new MgdConnectionFailedException(L"MgdSelectCommand.MgdSelectCommand", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdSelectCommand.MgdSelectCommand", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     // Create FdoISelect command
     FdoPtr<FdoIConnection> fdoConn = m_connection->GetConnection();
@@ -68,7 +68,7 @@
     // This operation is not supported by FdoISelect
     // m_command->SetDistinct(value);
 
-    // throw new MgInvalidOperationException(L"MgdSelectCommand.SetDistinct", __LINE__, __WFILE__, NULL, L"", NULL);
+    // throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdSelectCommand.SetDistinct", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 bool MgdSelectCommand::GetDistinct()
@@ -77,7 +77,7 @@
     // This operation is not supported by FdoISelect
     // return m_command->GetDistinct();
 
-    // throw new MgInvalidOperationException(L"MgdSelectCommand.GetDistinct", __LINE__, __WFILE__, NULL, L"", NULL);
+    // throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdSelectCommand.GetDistinct", __LINE__, __WFILE__, NULL, L"", NULL);
 
     return false;
 }
@@ -118,7 +118,7 @@
     // This operation is not supported by FdoISelect
     // return m_command->GetGrouping();
 
-    // throw new MgInvalidOperationException(L"MgdSelectCommand.GetGrouping", __LINE__, __WFILE__, NULL, L"", NULL);
+    // throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdSelectCommand.GetGrouping", __LINE__, __WFILE__, NULL, L"", NULL);
     return NULL;
 }
 
@@ -128,7 +128,7 @@
     // This operation is not supported by FdoISelect
     // m_command->SetGroupingFilter(filter);
 
-    // throw new MgInvalidOperationException(L"MgdSelectCommand.SetGroupingFilter", __LINE__, __WFILE__, NULL, L"", NULL);
+    // throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdSelectCommand.SetGroupingFilter", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 FdoFilter* MgdSelectCommand::GetGroupingFilter()
@@ -137,7 +137,7 @@
     // This operation is not supported by FdoISelect
     // return m_command->GetGroupingFilter(filter);
 
-    // throw new MgInvalidOperationException(L"MgdSelectCommand.GetGroupingFilter", __LINE__, __WFILE__, NULL, L"", NULL);
+    // throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdSelectCommand.GetGroupingFilter", __LINE__, __WFILE__, NULL, L"", NULL);
     return NULL;
 }
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/SelectFeatures.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/SelectFeatures.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/SelectFeatures.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -133,7 +133,7 @@
     {
         if (bFeatureJoinProperties)
         {
-            throw new MgInvalidOperationException(L"MgdSelectFeatures.SelectFeatures", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdSelectFeatures.SelectFeatures", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         m_command = MgdFeatureServiceCommand::CreateCommand(resource, FdoCommandType_ExtendedSelect);
@@ -189,7 +189,7 @@
 
             MgStringCollection arguments;
             arguments.Add(message);
-            throw new MgFeatureServiceException(L"MgdSelectFeatures.SelectFeatures", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdSelectFeatures.SelectFeatures", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
 
         // Custom function specified using SelectAggregate,
@@ -240,7 +240,7 @@
                     arguments.Add(L"1");
                     arguments.Add(L"MgdFeatureServiceCommand");
 
-                    throw new MgInvalidArgumentException(L"MgdSelectFeatures::SelectFeatures()",
+                    throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdSelectFeatures::SelectFeatures()",
                         __LINE__, __WFILE__, &arguments, L"MgCollectionEmpty", NULL);
 
                 }
@@ -633,7 +633,7 @@
 
         MgStringCollection arguments;
         arguments.Add(message);
-        throw new MgFeatureServiceException(L"MgdSelectFeatures.ApplyOrderingOptions", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdSelectFeatures.ApplyOrderingOptions", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     FdoPtr<FdoIdentifierCollection> fic = m_command->GetOrdering();
@@ -730,7 +730,7 @@
 
         MgStringCollection arguments;
         arguments.Add(message);
-        throw new MgFeatureServiceException(L"MgdSelectFeatures.AddCustomComputedProperty", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdSelectFeatures.AddCustomComputedProperty", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     // Downcast to FdoFunction
@@ -788,7 +788,7 @@
 
                 MgStringCollection arguments;
                 arguments.Add(message);
-                throw new MgFeatureServiceException(L"MgdSelectFeatures.ValidateConstraintsOnCustomFunctions",
+                throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdSelectFeatures.ValidateConstraintsOnCustomFunctions",
                     __LINE__, __WFILE__, &arguments, L"", NULL);
             }
             MgdFeatureUtil::ValidateCustomConstraints(m_customFunction);
@@ -820,7 +820,7 @@
         arguments.Add(L"2");
         arguments.Add(MgResources::BlankArgument);
 
-        throw new MgInvalidArgumentException(L"MgdSelectFeatures::ValidateParam()",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdSelectFeatures::ValidateParam()",
             __LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
     }
 }
@@ -887,7 +887,7 @@
 
         MgStringCollection arguments;
         arguments.Add(message);
-        throw new MgFeatureServiceException(L"MgdSelectFeatures.ApplyFdoGroupingProperties", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdSelectFeatures.ApplyFdoGroupingProperties", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     FdoPtr<FdoIdentifierCollection> fic = ((MgdFeatureServiceCommand*)m_command)->GetGrouping();
@@ -943,7 +943,7 @@
 
         MgStringCollection arguments;
         arguments.Add(message);
-        throw new MgFeatureServiceException(L"MgdSelectFeatures.ContainsCustomFunction",
+        throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdSelectFeatures.ContainsCustomFunction",
             __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
@@ -1276,7 +1276,7 @@
             }
             else
             {
-                throw new MgdConnectionFailedException(L"MgdSelectFeatures.JoinFeatures",
+                throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdSelectFeatures.JoinFeatures",
                     __LINE__, __WFILE__, NULL, L"", NULL);
             }
 
@@ -1423,7 +1423,7 @@
                     }
                     else
                     {
-                        throw new MgdConnectionFailedException(L"MgdSelectFeatures.JoinFeatures",
+                        throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdSelectFeatures.JoinFeatures",
                             __LINE__, __WFILE__, NULL, L"", NULL);
                     }
                 }
@@ -1666,7 +1666,7 @@
     {
         if (!conn->IsConnectionOpen())
         {
-            throw new MgdConnectionFailedException(L"MgdSelectFeatures.SupportsFdoJoin", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdSelectFeatures.SupportsFdoJoin", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         FdoPtr<FdoIConnection> fdoConn = conn->GetConnection();
@@ -1860,7 +1860,7 @@
     if (NULL == (FdoClassDefinition*)classDef)
     {
         //TODO: Refine message if available
-        throw new MgClassNotFoundException(L"MgdSelectFeatures.IsFunctionOnPrimaryProperty", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgClassNotFoundException, L"MgdSelectFeatures.IsFunctionOnPrimaryProperty", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     FdoPtr<FdoPropertyDefinitionCollection> properties = classDef->GetProperties();
@@ -1892,7 +1892,7 @@
     {
         if (!conn->IsConnectionOpen())
         {
-            throw new MgdConnectionFailedException(L"MgdSelectFeatures.SupportsFdoJoin", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdSelectFeatures.SupportsFdoJoin", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         FdoPtr<FdoIConnection> fdoConn = conn->GetConnection();
@@ -1934,7 +1934,7 @@
         if (NULL == (FdoClassDefinition*)classDef)
         {
             //TODO: Refine message if available
-            throw new MgClassNotFoundException(L"MgdSelectFeatures.FilterContainsSecondaryProperties", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgClassNotFoundException, L"MgdSelectFeatures.FilterContainsSecondaryProperties", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         FdoPtr<FdoPropertyDefinitionCollection> propDefs = classDef->GetProperties();
@@ -2015,7 +2015,7 @@
     {
         if (!conn->IsConnectionOpen())
         {
-            throw new MgdConnectionFailedException(L"MgdSelectFeatures.SelectFdoJoin", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdSelectFeatures.SelectFdoJoin", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         CHECKNULL(m_command, L"MgdSelectFeatures.SelectFdoJoin");
@@ -2255,7 +2255,7 @@
     if (NULL == (FdoClassDefinition*)classDef)
     {
         //TODO: Refine message if available
-        throw new MgClassNotFoundException(L"MgdSelectFeatures.ApplyClassProperties", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgClassNotFoundException, L"MgdSelectFeatures.ApplyClassProperties", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     FdoPtr<FdoIdentifierCollection> propNames = m_command->GetPropertyNames();

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/SqlCommand.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/SqlCommand.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/SqlCommand.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -139,7 +139,7 @@
     // SQL statement can not be empty
     if (resource == NULL)
     {
-        throw new MgNullArgumentException(L"MgdSqlCommand.Validate", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdSqlCommand.Validate", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     if (sqlStatement.empty())
@@ -148,7 +148,7 @@
         arguments.Add(L"2");
         arguments.Add(MgResources::BlankArgument);
 
-        throw new MgInvalidArgumentException(L"MgdSqlCommand.Validate",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdSqlCommand.Validate",
             __LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
     }
 
@@ -178,11 +178,11 @@
         {
             // TODO: specify which argument and message, once we have the mechanism
             STRING message = MgdFeatureUtil::GetMessage(L"MgCommandNotSupported");
-            throw new MgInvalidOperationException(L"MgdSqlCommand.Validate", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdSqlCommand.Validate", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
     else
     {
-        throw new MgdConnectionFailedException(L"MgdSqlCommand::Validate", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdSqlCommand::Validate", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/UpdateFeatures.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/UpdateFeatures.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/Commands/UpdateFeatures.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -48,7 +48,7 @@
     if ((NULL != m_SrvrFeatConn.p) && ( !m_SrvrFeatConn->IsConnectionOpen() ))
     {
 
-        throw new MgdConnectionFailedException(L"MgdUpdateFeaturesCommand::MgdUpdateFeaturesCommand()",
+        throw new MgException(MgExceptionCodes::MgConnectionFailedException, L"MgdUpdateFeaturesCommand::MgdUpdateFeaturesCommand()",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
 }
@@ -66,7 +66,7 @@
 
     if (resource == NULL || commands == NULL)
     {
-        throw new MgNullArgumentException(L"MgdUpdateFeaturesCommand.UpdateFeatures", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdUpdateFeaturesCommand.UpdateFeatures", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     INT32 cnt = commands->GetCount();
@@ -76,7 +76,7 @@
         arguments.Add(L"2");
         arguments.Add(L"0");
 
-        throw new MgInvalidArgumentException(L"MgdUpdateFeaturesCommand.UpdateFeatures",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdUpdateFeaturesCommand.UpdateFeatures",
             __LINE__, __WFILE__, &arguments, L"MgCollectionEmpty", NULL);
     }
 
@@ -158,7 +158,7 @@
 
     if (resource == NULL || commands == NULL)
     {
-        throw new MgNullArgumentException(L"MgdUpdateFeaturesCommand.UpdateFeatures", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdUpdateFeaturesCommand.UpdateFeatures", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     INT32 cnt = commands->GetCount();
@@ -168,7 +168,7 @@
         arguments.Add(L"2");
         arguments.Add(L"0");
 
-        throw new MgInvalidArgumentException(L"MgdUpdateFeaturesCommand.UpdateFeatures",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdUpdateFeaturesCommand.UpdateFeatures",
             __LINE__, __WFILE__, &arguments, L"MgCollectionEmpty", NULL);
     }
 
@@ -229,7 +229,7 @@
     CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdUpdateFeaturesCommand::ExecuteInsert");
     CHECKARGUMENTNULL(propertyValues, L"MgdUpdateFeaturesCommand::ExecuteInsert");
     if (className.empty())
-        throw new MgNullArgumentException(L"MgdUpdateFeaturesCommand::ExecuteInsert", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdUpdateFeaturesCommand::ExecuteInsert", __LINE__, __WFILE__, NULL, L"", NULL);
     
     Ptr<MgdFeatureConnection> connWrap;
     FdoPtr<FdoIConnection> conn;
@@ -241,7 +241,7 @@
         Ptr<MgResourceIdentifier> origFeatureSource = mgTrans->GetFeatureSource();
         //Check that the transaction originates from the same feature source
         if (origFeatureSource->ToString() != resource->ToString())
-            throw new MgInvalidArgumentException(L"MgdUpdateFeaturesCommand::ExecuteInsert", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdUpdateFeaturesCommand::ExecuteInsert", __LINE__, __WFILE__, NULL, L"", NULL);
 
         connWrap = mgTrans->GetConnection(); //Connection is already open
         fdoTrans = mgTrans->GetFdoTransaction();
@@ -286,7 +286,7 @@
     CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdUpdateFeaturesCommand::ExecuteUpdate");
     CHECKARGUMENTNULL(propertyValues, L"MgdUpdateFeaturesCommand::ExecuteUpdate");
     if (className.empty())
-        throw new MgNullArgumentException(L"MgdUpdateFeaturesCommand::ExecuteUpdate", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdUpdateFeaturesCommand::ExecuteUpdate", __LINE__, __WFILE__, NULL, L"", NULL);
 
     Ptr<MgdFeatureConnection> connWrap;
     FdoPtr<FdoIConnection> conn;
@@ -298,7 +298,7 @@
         Ptr<MgResourceIdentifier> origFeatureSource = mgTrans->GetFeatureSource();
         //Check that the transaction originates from the same feature source
         if (origFeatureSource->ToString() != resource->ToString())
-            throw new MgInvalidArgumentException(L"MgdUpdateFeaturesCommand::ExecuteUpdate", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdUpdateFeaturesCommand::ExecuteUpdate", __LINE__, __WFILE__, NULL, L"", NULL);
 
         connWrap = mgTrans->GetConnection(); //Connection is already open
         fdoTrans = mgTrans->GetFdoTransaction();
@@ -342,7 +342,7 @@
 
     CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdUpdateFeaturesCommand::ExecuteDelete");
     if (className.empty())
-        throw new MgNullArgumentException(L"MgdUpdateFeaturesCommand::ExecuteDelete", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdUpdateFeaturesCommand::ExecuteDelete", __LINE__, __WFILE__, NULL, L"", NULL);
 
     Ptr<MgdFeatureConnection> connWrap;
     FdoPtr<FdoIConnection> conn;
@@ -355,7 +355,7 @@
         Ptr<MgResourceIdentifier> origFeatureSource = mgTrans->GetFeatureSource();
         //Check that the transaction originates from the same feature source
         if (origFeatureSource->ToString() != resource->ToString())
-            throw new MgInvalidArgumentException(L"MgdUpdateFeaturesCommand::ExecuteDelete", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdUpdateFeaturesCommand::ExecuteDelete", __LINE__, __WFILE__, NULL, L"", NULL);
 
         connWrap = mgTrans->GetConnection(); //Connection is already open
         fdoTrans = mgTrans->GetFdoTransaction();

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FdoConnectionPool.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FdoConnectionPool.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FdoConnectionPool.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MgDesktop.h"
 #include "System/Mutex.h"
 #include "FdoConnectionPool.h"

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FdoConnectionUtil.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FdoConnectionUtil.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FdoConnectionUtil.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MgDesktop.h"
 #include "FdoConnectionUtil.h"
 #include "Fdo.h"
@@ -143,7 +160,7 @@
                 strCol = new MgStringCollection();
                 strCol->Add(message);
             }
-            throw new MgdInvalidFeatureSourceException(L"MgdFdoConnectionUtil::CreateConnection",
+            throw new MgException(MgExceptionCodes::MgInvalidFeatureSourceException, L"MgdFdoConnectionUtil::CreateConnection",
                 __LINE__, __WFILE__, (MgStringCollection*)strCol, L"", NULL);
         }
 
@@ -246,7 +263,7 @@
             STRING errorMsg = parser.GetErrorMessage();
             MgStringCollection arguments;
             arguments.Add(errorMsg);
-            throw new MgdInvalidFeatureSourceException(
+            throw new MgException(MgExceptionCodes::MgInvalidFeatureSourceException, 
                 L"MgdFdoConnectionUtil::GetFeatureSource",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
@@ -265,7 +282,7 @@
         MgStringCollection arguments;
         arguments.Add(message);
 
-        throw new MgdInvalidFeatureSourceException(
+        throw new MgException(MgExceptionCodes::MgInvalidFeatureSourceException, 
             L"MgdFdoConnectionUtil::GetFeatureSource",
             __LINE__, __WFILE__, &arguments, L"", NULL);
     }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FdoConnectionUtil.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FdoConnectionUtil.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FdoConnectionUtil.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_FDO_CONNECTION_UTIL_H
 #define DESKTOP_FDO_CONNECTION_UTIL_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FdoForcedOneToOneFeatureReader.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FdoForcedOneToOneFeatureReader.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FdoForcedOneToOneFeatureReader.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "FdoForcedOneToOneFeatureReader.h"
 
 // constructs a MgdFdoForcedOneToOneFeatureReader

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureClassCacheItem.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureClassCacheItem.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureClassCacheItem.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MgDesktop.h"
 #include "FeatureClassCacheItem.h"
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureClassCacheItem.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureClassCacheItem.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureClassCacheItem.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_FEATURE_CLASS_CACHE_ITEM_H
 #define DESKTOP_FEATURE_CLASS_CACHE_ITEM_H
 /// \cond INTERNAL

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureConnection.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureConnection.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureConnection.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "Fdo.h"
 #include "FdoConnectionUtil.h"
 #include "FeatureConnection.h"

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureConnection.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureConnection.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureConnection.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_FEATURE_CONNECTION_H
 #define DESKTOP_FEATURE_CONNECTION_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureDefs.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureDefs.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureDefs.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_FEATURE_DEFS_H
 #define DESKTOP_FEATURE_DEFS_H
 
@@ -7,7 +24,7 @@
     CHECKARGUMENTNULL(resource, method);                                                            \
     resource->Validate();                                                                           \
     if (resource->GetResourceType() != MgResourceType::FeatureSource)                               \
-        throw new MgInvalidResourceTypeException(method, __LINE__, __WFILE__, NULL, L"", NULL)
+        throw new MgException(MgExceptionCodes::MgInvalidResourceTypeException, method, __LINE__, __WFILE__, NULL, L"", NULL)
 
 #define MG_FEATURE_SERVICE_TRY()                                              \
     MG_TRY()                                                                  \
@@ -39,7 +56,8 @@
         }                                                                     \
                                                                               \
         FDO_SAFE_RELEASE(e);                                                  \
-        mgException = new MgFdoException(methodName, __LINE__, __WFILE__, NULL, messageId, &arguments, nativeErrorCode); \
+        mgException = new MgException(MgExceptionCodes::MgFdoException, methodName, __LINE__, __WFILE__, NULL, messageId, &arguments); \
+        mgException->SetNativeErrorCode(nativeErrorCode);                     \
                                                                               \
     MG_CATCH(methodName)                                                      \
 
@@ -71,7 +89,8 @@
         }                                                                     \
                                                                               \
         FDO_SAFE_RELEASE(e);                                                  \
-        mgException = new MgFdoException(methodName, __LINE__, __WFILE__, NULL, messageId, &arguments, nativeErrorCode); \
+        mgException = new MgException(MgExceptionCodes::MgFdoException, methodName, __LINE__, __WFILE__, NULL, messageId, &arguments); \
+        mgException->SetNativeErrorCode(nativeErrorCode);                     \
                                                                               \
     MG_CATCH(methodName)                                                      \
 
@@ -145,7 +164,8 @@
         }                                                                     \
                                                                               \
         FDO_SAFE_RELEASE(e);                                                  \
-        mgException = new MgFdoException(methodName, __LINE__, __WFILE__, NULL, messageId, &arguments, nativeErrorCode); \
+        mgException = new MgException(MgExceptionCodes::MgFdoException, methodName, __LINE__, __WFILE__, NULL, messageId, &arguments); \
+        mgException->SetNativeErrorCode(nativeErrorCode);                     \
                                                                               \
     MG_CATCH(methodName)                                                      \
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureDistribution.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureDistribution.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureDistribution.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -95,7 +95,7 @@
         }
         default:
         {
-            throw new MgInvalidPropertyTypeException(
+            throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, 
                 L"MgdFeatureDistribution.CreateDistributionFunction", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureGeometricFunctions.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureGeometricFunctions.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureGeometricFunctions.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -73,7 +73,7 @@
     // because we can only come to here if property type is numeric
     if (!this->CheckSupportedPropertyType())
     {
-        throw new MgInvalidPropertyTypeException(
+        throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, 
             L"MgdFeatureGeometricFunctions.Initialize", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -86,7 +86,7 @@
 
         MgStringCollection arguments;
         arguments.Add(message);
-        throw new MgFeatureServiceException(L"MgdFeatureGeometricFunctions.Initialize", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdFeatureGeometricFunctions.Initialize", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     m_reader = SAFE_ADDREF(reader);
@@ -234,7 +234,7 @@
 
                 MgStringCollection arguments;
                 arguments.Add(message);
-                throw new MgFeatureServiceException(
+                throw new MgException(MgExceptionCodes::MgFeatureServiceException, 
                     L"MgdFeatureGeometricFunctions.ExecuteOperation",
                     __LINE__, __WFILE__, &arguments, L"", NULL);
             }
@@ -272,7 +272,7 @@
             }
             default:
             {
-                throw new MgInvalidPropertyTypeException(
+                throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, 
                     L"MgdFeatureGeometricFunctions.GetValue",
                     __LINE__, __WFILE__, NULL, L"", NULL);
             }
@@ -300,7 +300,7 @@
         }
         default:
         {
-            throw new MgInvalidPropertyTypeException(
+            throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, 
                 L"MgdFeatureGeometricFunctions.GetReader", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureNumericFunctions.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureNumericFunctions.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureNumericFunctions.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -91,7 +91,7 @@
 
         MgStringCollection arguments;
         arguments.Add(message);
-        throw new MgFeatureServiceException(L"MgdFeatureDistribution.Initialize", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdFeatureDistribution.Initialize", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     m_reader = SAFE_ADDREF(reader);
@@ -189,7 +189,7 @@
         }
         default:
         {
-            throw new MgInvalidPropertyTypeException(L"MgdFeatureNumericFunctions.CheckSupportedPropertyType",
+            throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, L"MgdFeatureNumericFunctions.CheckSupportedPropertyType",
                 __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
@@ -248,7 +248,7 @@
             }
             default:
             {
-                throw new MgInvalidPropertyTypeException(L"MgdFeatureNumericFunctions.CheckSupportedPropertyType",
+                throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, L"MgdFeatureNumericFunctions.CheckSupportedPropertyType",
                     __LINE__, __WFILE__, NULL, L"", NULL);
             }
         }
@@ -266,7 +266,7 @@
 
         MgStringCollection arguments;
         arguments.Add(message);
-        throw new MgFeatureServiceException(L"MgdFeatureNumericFunctions::GetEqualCategories", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdFeatureNumericFunctions::GetEqualCategories", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     // find the range of the data values
@@ -501,7 +501,7 @@
         }
         default:
         {
-            throw new MgInvalidPropertyTypeException(L"MgdFeatureNumericFunctions.CheckSupportedPropertyType",
+            throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, L"MgdFeatureNumericFunctions.CheckSupportedPropertyType",
                 __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }
@@ -529,7 +529,7 @@
 
         MgStringCollection arguments;
         arguments.Add(message);
-        throw new MgFeatureServiceException(L"MgdFeatureNumericFunctions::GetStandardDeviationCategories", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdFeatureNumericFunctions::GetStandardDeviationCategories", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     // collect information about the data values
@@ -629,7 +629,7 @@
 
         MgStringCollection arguments;
         arguments.Add(message);
-        throw new MgFeatureServiceException(L"MgdFeatureNumericFunctions::GetQuantileCategories", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdFeatureNumericFunctions::GetQuantileCategories", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     int count = (int)values.size();

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSchemaCacheItem.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSchemaCacheItem.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSchemaCacheItem.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MgDesktop.h"
 #include "FeatureSchemaCacheItem.h"
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSchemaCacheItem.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSchemaCacheItem.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSchemaCacheItem.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_FEATURE_SCHEMA_CACHE_ITEM_H
 #define DESKTOP_FEATURE_SCHEMA_CACHE_ITEM_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureServiceCache.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureServiceCache.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureServiceCache.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MgDesktop.h"
 #include "FeatureServiceCache.h"
 
@@ -97,7 +114,7 @@
 {
     if (NULL == resource)
     {
-        throw new MgNullArgumentException(
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, 
             L"MgdFeatureServiceCache::GetEntry",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
@@ -106,7 +123,7 @@
 
     if (!resource->IsResourceTypeOf(MgResourceType::FeatureSource))
     {
-        throw new MgInvalidResourceTypeException(
+        throw new MgException(MgExceptionCodes::MgInvalidResourceTypeException, 
             L"MgdFeatureServiceCache::GetEntry",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
@@ -384,7 +401,7 @@
                 STRING errorMsg = parser.GetErrorMessage();
                 MgStringCollection arguments;
                 arguments.Add(errorMsg);
-                throw new MgdInvalidFeatureSourceException(
+                throw new MgException(MgExceptionCodes::MgInvalidFeatureSourceException, 
                     L"MgCacheManager::GetFeatureSourceCacheItem",
                     __LINE__, __WFILE__, &arguments, L"", NULL);
             }
@@ -404,7 +421,7 @@
             MgStringCollection arguments;
             arguments.Add(message);
 
-            throw new MgdInvalidFeatureSourceException(
+            throw new MgException(MgExceptionCodes::MgInvalidFeatureSourceException, 
                 L"MgCacheManager.GetFeatureSourceCacheItem",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureServiceCache.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureServiceCache.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureServiceCache.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_FEATURE_SERVICE_CACHE_H
 #define DESKTOP_FEATURE_SERVICE_CACHE_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureServiceCacheEntry.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureServiceCacheEntry.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureServiceCacheEntry.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MgDesktop.h"
 #include "FeatureServiceCacheEntry.h"
 
@@ -91,7 +108,7 @@
         MgStringCollection whyArguments;
         whyArguments.Add(className);
 
-        throw new MgInvalidArgumentException(L"MgdFeatureServiceCacheEntry.ParseQualifiedClassName",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdFeatureServiceCacheEntry.ParseQualifiedClassName",
             __LINE__, __WFILE__, &whatArguments, L"MgSchemaNameMismatch", &whyArguments);
     }
 }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureServiceCacheEntry.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureServiceCacheEntry.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureServiceCacheEntry.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_FEATURE_SERVICE_CACHE_ENTRY_H
 #define DESKTOP_FEATURE_SERVICE_CACHE_ENTRY_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSetReader.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSetReader.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSetReader.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MgDesktop.h"
 #include "FeatureSetReader.h"
 
@@ -4,7 +21,7 @@
 #define CHECK_FEATURESET_COUNT(pointer, methodname)        \
 if (0 == pointer->GetCount())                           \
 {                                                       \
-    throw new MgEmptyFeatureSetException(methodname,    \
+    throw new MgException(MgExceptionCodes::MgEmptyFeatureSetException, methodname,    \
                                        __LINE__, __WFILE__, NULL, L"", NULL); \
 }
 
@@ -11,7 +28,7 @@
 #define CHECK_PROPERTY_TYPE(property, type, methodname) \
 if (property != type)                                   \
 {                                                       \
-    throw new MgInvalidPropertyTypeException(methodname, \
+    throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, methodname, \
                                        __LINE__, __WFILE__, NULL, L"", NULL); \
 }
 
@@ -613,7 +630,7 @@
         MgStringCollection arguments;
         arguments.Add(propertyName);
 
-        throw new MgNullPropertyValueException(L"MgdFeatureSetReader.GetProperty",
+        throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureSetReader.GetProperty",
             __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
@@ -636,7 +653,7 @@
         MgStringCollection arguments;
         arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgdFeatureSetReader.GetProperty",
+        throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureSetReader.GetProperty",
             __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
@@ -845,7 +862,7 @@
 /// <returns>Returns a ByteReader object</returns>
 BYTE_ARRAY_OUT MgdFeatureSetReader::GetGeometry(CREFSTRING propertyName, INT32& length)
 {
-    throw new MgNotImplementedException(L"MgdFeatureSetReader.GetGeometry",
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgdFeatureSetReader.GetGeometry",
         __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
@@ -858,7 +875,7 @@
 /// <returns>Returns a ByteReader object</returns>
 BYTE_ARRAY_OUT MgdFeatureSetReader::GetGeometry(INT32 index, INT32& length)
 {
-    throw new MgNotImplementedException(L"MgdFeatureSetReader.GetGeometry",
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgdFeatureSetReader.GetGeometry",
         __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
@@ -894,7 +911,7 @@
 
 MgFeatureSet* MgdFeatureSetReader::GetFeatures(INT32 count)
 {
-    throw new MgNotImplementedException(L"MgdFeatureSetReader.GetFeatures",
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgdFeatureSetReader.GetFeatures",
         __LINE__, __WFILE__, NULL, L"", NULL);
 }
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSetReader.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSetReader.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSetReader.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_FEATURE_SET_READER_H
 #define DESKTOP_FEATURE_SET_READER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSourceCacheItem.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSourceCacheItem.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSourceCacheItem.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MgDesktop.h"
 #include "FeatureSourceCacheItem.h"
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSourceCacheItem.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSourceCacheItem.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureSourceCacheItem.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_FEATURE_SOURCE_CACHE_ITEM_H
 #define DESKTOP_FEATURE_SOURCE_CACHE_ITEM_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureStringFunctions.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureStringFunctions.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureStringFunctions.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -72,7 +72,7 @@
     // because we can only come to here if property type is numeric
     if (!this->CheckSupportedPropertyType()) 
     {
-        throw new MgInvalidPropertyTypeException(
+        throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, 
             L"MgdFeatureStringFunctions.Initialize", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     // We must have an property alias
@@ -84,7 +84,7 @@
 
         MgStringCollection arguments;
         arguments.Add(message);
-        throw new MgFeatureServiceException(L"MgdFeatureStringFunctions.Initialize", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdFeatureStringFunctions.Initialize", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     m_reader = SAFE_ADDREF(reader);
@@ -151,7 +151,7 @@
             }
             default:
             {
-                throw new MgInvalidPropertyTypeException(
+                throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, 
                     L"MgdFeatureStringFunctions.GetValue", __LINE__, __WFILE__, NULL, L"", NULL);
             }
         }
@@ -186,7 +186,7 @@
 
                 MgStringCollection arguments;
                 arguments.Add(message);
-                throw new MgFeatureServiceException(
+                throw new MgException(MgExceptionCodes::MgFeatureServiceException, 
                     L"MgdFeatureStringFunctions.ExecuteOperation", __LINE__, __WFILE__, &arguments, L"", NULL);
             }
         }
@@ -208,7 +208,7 @@
         }
         default:
         {
-            throw new MgInvalidPropertyTypeException(
+            throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, 
                 L"MgdFeatureStringFunctions.GetReader", __LINE__, __WFILE__, NULL, L"", NULL);
         }
     }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureUtil.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureUtil.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureUtil.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "FeatureUtil.h"
 #include "FeatureDefs.h"
 #include "Services/ByteSourceRasterStreamImpl.h"
@@ -187,7 +204,7 @@
 
         MgStringCollection arguments;
         arguments.Add(customFunction->GetName());
-        throw new MgFeatureServiceException(L"MgdFeatureUtil.GetArguments", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdFeatureUtil.GetArguments", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     FdoString *arg0 = NULL, *arg1 = NULL, *arg2 = NULL, *arg3 = NULL;
@@ -273,7 +290,7 @@
 
         MgStringCollection arguments;
         arguments.Add(message);
-        throw new MgFeatureServiceException(L"MgdFeatureUtil.GetPropertyDefinition", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdFeatureUtil.GetPropertyDefinition", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     // Get the name of property
@@ -329,7 +346,7 @@
 
                     MgStringCollection arguments;
                     arguments.Add(message);
-                    throw new MgFeatureServiceException(L"MgdFeatureUtil.ValidateCustomConstraints",
+                    throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdFeatureUtil.ValidateCustomConstraints",
                         __LINE__, __WFILE__, &arguments, L"", NULL);
                 }
                 break;
@@ -347,7 +364,7 @@
 
                     MgStringCollection arguments;
                     arguments.Add(message);
-                    throw new MgFeatureServiceException(L"MgdFeatureUtil.ValidateCustomConstraints",
+                    throw new MgException(MgExceptionCodes::MgFeatureServiceException, L"MgdFeatureUtil.ValidateCustomConstraints",
                         __LINE__, __WFILE__, &arguments, L"", NULL);
                 }
                 break;
@@ -360,7 +377,7 @@
 {
     int cnt = (int)v.size();
     if (cnt <= 0)
-        throw new MgIndexOutOfRangeException(L"MgdFeatureUtil.Minimum", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgIndexOutOfRangeException, L"MgdFeatureUtil.Minimum", __LINE__, __WFILE__, NULL, L"", NULL);
     double min = v[0];
     for (int i = 1; i < cnt; ++i)
     {
@@ -375,7 +392,7 @@
 {
     int cnt = (int)v.size();
     if (cnt <= 0)
-        throw new MgIndexOutOfRangeException(L"MgdFeatureUtil.Minimum", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgIndexOutOfRangeException, L"MgdFeatureUtil.Minimum", __LINE__, __WFILE__, NULL, L"", NULL);
     INT64 min = v[0];
     for (int i = 1; i < cnt; ++i)
     {
@@ -390,7 +407,7 @@
 {
     int cnt = (int)v.size();
     if (cnt <= 0)
-        throw new MgIndexOutOfRangeException(L"MgdFeatureUtil.Maximum", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgIndexOutOfRangeException, L"MgdFeatureUtil.Maximum", __LINE__, __WFILE__, NULL, L"", NULL);
     double max = v[0];
     for (int i = 1; i < cnt; ++i)
     {
@@ -405,7 +422,7 @@
 {
     int cnt = (int)v.size();
     if (cnt <= 0)
-        throw new MgIndexOutOfRangeException(L"MgdFeatureUtil.Maximum", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgIndexOutOfRangeException, L"MgdFeatureUtil.Maximum", __LINE__, __WFILE__, NULL, L"", NULL);
     INT64 max = v[0];
     for (int i = 1; i < cnt; ++i)
     {
@@ -513,7 +530,7 @@
         arguments.Add(L"2");
         arguments.Add(MgResources::BlankArgument);
 
-        throw new MgInvalidArgumentException(L"MgdFeatureUtil.GetRaster",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdFeatureUtil.GetRaster",
             __LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
     }
 
@@ -594,7 +611,7 @@
 
     if (source->GetCount() != target->GetCount())
     {
-        throw new MgInvalidArgumentException(L"MgdFeatureUtil.UpdateParameterCollection",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdFeatureUtil.UpdateParameterCollection",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -1072,13 +1089,13 @@
         }
         case MgPropertyType::Feature:
         {
-            throw new MgInvalidPropertyTypeException(L"MgdFeatureUtil.MgPropertyToFdoProperty",
+            throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, L"MgdFeatureUtil.MgPropertyToFdoProperty",
                 __LINE__, __WFILE__, NULL, L"", NULL);
             break;
         }
         case MgPropertyType::Raster:
         {
-            throw new MgInvalidPropertyTypeException(L"MgdFeatureUtil.MgPropertyToFdoProperty",
+            throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, L"MgdFeatureUtil.MgPropertyToFdoProperty",
                 __LINE__, __WFILE__, NULL, L"", NULL);
             break;
         }
@@ -2018,7 +2035,7 @@
         FdoPtr<FdoFeatureSchema> fdoSchema = GetFdoFeatureSchema(mgSchema);
         if (fdoSchemaCol->Contains(fdoSchema))
         {
-            throw new MgDuplicateObjectException(L"MgdFeatureUtil.GetFdoFeatureSchemaCollection", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgDuplicateObjectException, L"MgdFeatureUtil.GetFdoFeatureSchemaCollection", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         else
         {
@@ -2617,7 +2634,7 @@
             arguments.Add(L"1");
             arguments.Add(buffer);
 
-            throw new MgInvalidArgumentException(L"MgdFeatureUtil.GetFdoDataType",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdFeatureUtil.GetFdoDataType",
                 __LINE__, __WFILE__, &arguments, L"MgInvalidPropertyType", NULL);
         }
     }
@@ -2660,7 +2677,7 @@
             arguments.Add(L"1");
             arguments.Add(buffer);
 
-            throw new MgInvalidArgumentException(L"MgdFeatureUtil.GetFdoParameterDirection",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdFeatureUtil.GetFdoParameterDirection",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
     }
@@ -2703,7 +2720,7 @@
             arguments.Add(L"1");
             arguments.Add(buffer);
 
-            throw new MgInvalidArgumentException(L"MgdFeatureUtil.GetMgParameterDirection",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdFeatureUtil.GetMgParameterDirection",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
     }
@@ -2865,7 +2882,7 @@
     {
         FdoFeatureClass* fdoFeatureClass = dynamic_cast<FdoFeatureClass*>(fdoClassDef);
         if (NULL == fdoFeatureClass)
-            throw new MgInvalidArgumentException(L"MgdFeatureUtil.UpdateFdoClassDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdFeatureUtil.UpdateFdoClassDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
 
         FdoPtr<FdoGeometricPropertyDefinition> defaultGeom = (FdoGeometricPropertyDefinition*)fdoPropDefCol->GetItem(geomName.c_str());
         fdoFeatureClass->SetGeometryProperty(defaultGeom);
@@ -2990,7 +3007,7 @@
         {
             FdoDataPropertyDefinition* fdoDataPropDef = dynamic_cast<FdoDataPropertyDefinition*>(fdoPropDef);
             if (NULL == fdoDataPropDef)
-                throw new MgInvalidArgumentException(L"MgdFeatureUtil.UpdateFdoClassDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdFeatureUtil.UpdateFdoClassDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
 
             UpdateDataPropertyDefinition((MgDataPropertyDefinition*)mgPropDef, fdoDataPropDef);
             break;
@@ -3000,7 +3017,7 @@
         {
             FdoObjectPropertyDefinition* fdoObjectPropDef = dynamic_cast<FdoObjectPropertyDefinition*>(fdoPropDef);
             if (NULL == fdoObjectPropDef)
-                throw new MgInvalidArgumentException(L"MgdFeatureUtil.UpdateFdoClassDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdFeatureUtil.UpdateFdoClassDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
 
             UpdateObjectPropertyDefinition((MgObjectPropertyDefinition*)mgPropDef, fdoObjectPropDef, fdoClassCol);
             break;
@@ -3011,7 +3028,7 @@
         {
             FdoGeometricPropertyDefinition* fdoGeometricPropDef = dynamic_cast<FdoGeometricPropertyDefinition*>(fdoPropDef);
             if (NULL == fdoGeometricPropDef)
-                throw new MgInvalidArgumentException(L"MgdFeatureUtil.UpdateFdoClassDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdFeatureUtil.UpdateFdoClassDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
 
             UpdateGeometricPropertyDefinition((MgGeometricPropertyDefinition*)mgPropDef, fdoGeometricPropDef);
             break;
@@ -3028,7 +3045,7 @@
         {
             FdoRasterPropertyDefinition* fdoRasterPropDef = dynamic_cast<FdoRasterPropertyDefinition*>(fdoPropDef);
             if (NULL == fdoRasterPropDef)
-                throw new MgInvalidArgumentException(L"MgdFeatureUtil.UpdateFdoClassDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdFeatureUtil.UpdateFdoClassDefinition", __LINE__, __WFILE__, NULL, L"", NULL);
 
             UpdateRasterPropertyDefinition((MgRasterPropertyDefinition*)mgPropDef, fdoRasterPropDef);
             break;

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureUtil.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureUtil.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/FeatureUtil.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_FEATURE_UTIL
 #define DESKTOP_FEATURE_UTIL
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/GwsFeatureReader.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/GwsFeatureReader.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/GwsFeatureReader.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -201,7 +201,7 @@
                 if (m_attributeNameDelimiters->GetCount() != (INT32)m_primaryExtendedFeatureDescription->GetCount())
                 {
                     // Should never get here
-                    throw new MgInvalidArgumentException(L"MgdGwsFeatureReader.ReadNext",
+                    throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdGwsFeatureReader.ReadNext",
                         __LINE__, __WFILE__, NULL, L"MgInvalidCollectionSize", NULL);
                 }
 
@@ -320,7 +320,7 @@
                         if (m_attributeNameDelimiters->GetCount() != (INT32)m_primaryExtendedFeatureDescription->GetCount())
                         {
                             // Should never get here
-                            throw new MgInvalidArgumentException(L"MgdGwsFeatureReader.ReadNext",
+                            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdGwsFeatureReader.ReadNext",
                                 __LINE__, __WFILE__, NULL, L"MgInvalidCollectionSize", NULL);
                         }
 
@@ -517,7 +517,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdGwsFeatureReader.GetBoolean",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdGwsFeatureReader.GetBoolean",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -559,7 +559,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdGwsFeatureReader.GetByte",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdGwsFeatureReader.GetByte",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -603,7 +603,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdGwsFeatureReader.GetDateTime",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdGwsFeatureReader.GetDateTime",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -645,7 +645,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdGwsFeatureReader.GetSingle",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdGwsFeatureReader.GetSingle",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -687,7 +687,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdGwsFeatureReader.GetDouble",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdGwsFeatureReader.GetDouble",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -729,7 +729,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdGwsFeatureReader.GetInt16",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdGwsFeatureReader.GetInt16",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -771,7 +771,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdGwsFeatureReader.GetInt32",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdGwsFeatureReader.GetInt32",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -815,7 +815,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdGwsFeatureReader.GetInt64",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdGwsFeatureReader.GetInt64",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -861,7 +861,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdGwsFeatureReader.GetString",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdGwsFeatureReader.GetString",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -914,7 +914,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdGwsFeatureReader.GetBLOB",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdGwsFeatureReader.GetBLOB",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -967,7 +967,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdGwsFeatureReader.GetCLOB",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdGwsFeatureReader.GetCLOB",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -991,7 +991,7 @@
 MgFeatureReader* MgdGwsFeatureReader::GetFeatureObject(CREFSTRING propertyName)
 {
     // TODO: Figure out how to support object properties.
-    throw new MgNotImplementedException(L"MgdGwsFeatureReader.GetFeatureObject", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgdGwsFeatureReader.GetFeatureObject", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 //////////////////////////////////////////////////////////////////
@@ -1033,7 +1033,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdGwsFeatureReader.GetGeometry",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdGwsFeatureReader.GetGeometry",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -1076,7 +1076,7 @@
         MgStringCollection arguments;
         arguments.Add(propertyName);
 
-        throw new MgNullPropertyValueException(L"MgdGwsFeatureReader.GetRaster",
+        throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdGwsFeatureReader.GetRaster",
             __LINE__, __WFILE__, &arguments, L"", NULL);
     }
     else
@@ -1112,7 +1112,7 @@
     {
         // TODO: specify which argument and message, once we have the mechanism
         STRING message = MgdFeatureUtil::GetMessage(L"MgMissingRasterProperty");
-        throw new MgInvalidOperationException(L"MgdFeatureReader::GetRaster", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdFeatureReader::GetRaster", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     // There can be more than one Raster property
@@ -1258,7 +1258,7 @@
 /// <returns>MgByteReader holding XML.</returns>
 MgByteReader* MgdGwsFeatureReader::ToXml()
 {
-    throw new MgInvalidOperationException(L"MgdGwsFeatureReader.ToXml",
+    throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdGwsFeatureReader.ToXml",
         __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
@@ -1405,7 +1405,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdGwsFeatureReader::GetGeometry",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdGwsFeatureReader::GetGeometry",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -1441,7 +1441,7 @@
         MgStringCollection arguments;
         arguments.Add(propertyName);
 
-        throw new MgNullPropertyValueException(L"MgdGwsFeatureReader::GetString",
+        throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdGwsFeatureReader::GetString",
             __LINE__, __WFILE__, &arguments, L"", NULL);
     }
     else
@@ -1482,7 +1482,7 @@
         arguments.Add(L"1");
         arguments.Add(MgResources::BlankArgument);
 
-        throw new MgInvalidArgumentException(L"MgdGwsFeatureReader.DeterminePropertyFeatureSource",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdGwsFeatureReader.DeterminePropertyFeatureSource",
             __LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
     }
 
@@ -1821,7 +1821,7 @@
                 if (m_attributeNameDelimiters->GetCount() != nSecondaryFeatures)
                 {
                     // Should never get here
-                    throw new MgInvalidArgumentException(L"MgdGwsFeatureReader.GetMgClassDefinition", __LINE__, __WFILE__, NULL, L"MgInvalidCollectionSize", NULL);
+                    throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdGwsFeatureReader.GetMgClassDefinition", __LINE__, __WFILE__, NULL, L"MgInvalidCollectionSize", NULL);
                 }
             }
 
@@ -1894,8 +1894,10 @@
 
                     FDO_SAFE_RELEASE(e);
 
-                    throw new MgFdoException(L"MgdGwsFeatureReader.GetMgClassDefinition",
-                        __LINE__, __WFILE__, NULL, messageId, &arguments, nativeErrorCode);
+                    auto ex = new MgException(MgExceptionCodes::MgFdoException, L"MgdGwsFeatureReader.GetMgClassDefinition",
+                        __LINE__, __WFILE__, NULL, messageId, &arguments);
+                    ex->SetNativeErrorCode(nativeErrorCode);
+                    throw ex;
                 }
             }
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/JoinFeatureReader.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/JoinFeatureReader.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/JoinFeatureReader.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -77,7 +77,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdJoinFeatureReader.GetBoolean",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdJoinFeatureReader.GetBoolean",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -112,7 +112,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdJoinFeatureReader.GetByte",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdJoinFeatureReader.GetByte",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -147,7 +147,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdJoinFeatureReader.GetDateTime",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdJoinFeatureReader.GetDateTime",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -182,7 +182,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdJoinFeatureReader.GetDouble",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdJoinFeatureReader.GetDouble",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -217,7 +217,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdJoinFeatureReader.GetInt16",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdJoinFeatureReader.GetInt16",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -252,7 +252,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdJoinFeatureReader.GetInt32",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdJoinFeatureReader.GetInt32",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -287,7 +287,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdJoinFeatureReader.GetInt64",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdJoinFeatureReader.GetInt64",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -322,7 +322,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdJoinFeatureReader.GetSingle",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdJoinFeatureReader.GetSingle",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -357,7 +357,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdJoinFeatureReader.GetString",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdJoinFeatureReader.GetString",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -392,7 +392,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdJoinFeatureReader.GetLOB",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdJoinFeatureReader.GetLOB",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -452,7 +452,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdJoinFeatureReader.GetGeometry",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdJoinFeatureReader.GetGeometry",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -485,7 +485,7 @@
         MgStringCollection arguments;
         arguments.Add(propertyName);
 
-        throw new MgNullPropertyValueException(L"MgdJoinFeatureReader::GetRaster",
+        throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdJoinFeatureReader::GetRaster",
             __LINE__, __WFILE__, &arguments, L"", NULL);
     }
     else
@@ -550,7 +550,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdJoinFeatureReader.GetGeometry",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdJoinFeatureReader.GetGeometry",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -585,7 +585,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdJoinFeatureReader.GetFeatureObject",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdJoinFeatureReader.GetFeatureObject",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -1109,7 +1109,7 @@
             // TODO: Fdo has some inconsistency with Decimal, therefore MapGuide
             // TODO: does not support it. Making this type as invalid argument
             // TODO: until we determine what to do with it???
-            //throw new MgInvalidArgumentException(L"MgServerGetFeatures.GetMgPropertyType", __LINE__, __WFILE__, NULL, L"", NULL);
+            //throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgServerGetFeatures.GetMgPropertyType", __LINE__, __WFILE__, NULL, L"", NULL);
             // propDef = new MgPropertyDefinition(name, ptDecimal);
             // break;
         //}
@@ -1176,7 +1176,7 @@
             arguments.Add(L"1");
             arguments.Add(buffer);
 
-            throw new MgInvalidArgumentException(L"MgdJoinFeatureReader.GetFdoDataType",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdJoinFeatureReader.GetFdoDataType",
                 __LINE__, __WFILE__, &arguments, L"MgInvalidPropertyType", NULL);
         }
     }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/MgCSTrans.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/MgCSTrans.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/MgCSTrans.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MgCSTrans.h"
 #include "CoordinateSystem/CoordinateSystem.h"
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/MgCSTrans.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/MgCSTrans.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/MgCSTrans.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_CS_TRANS_H
 #define DESKTOP_CS_TRANS_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/ProjectedFeatureReader.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/ProjectedFeatureReader.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/ProjectedFeatureReader.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MgDesktop.h"
 
 MgdProjectedFeatureReader::MgdProjectedFeatureReader(MgFeatureReader* reader, MgCoordinateSystemTransform* trans)

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/ProjectedFeatureReader.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/ProjectedFeatureReader.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/ProjectedFeatureReader.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_PROJECTED_FEATURE_READER_H
 #define DESKTOP_PROJECTED_FEATURE_READER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/ProxyDataReader.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/ProxyDataReader.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/ProxyDataReader.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -811,7 +811,7 @@
         MgStringCollection arguments;
         arguments.Add(propertyName);
 
-        throw new MgNullPropertyValueException(L"MgdProxyDataReader.GetProperty",
+        throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdProxyDataReader.GetProperty",
             __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
@@ -850,7 +850,7 @@
         MgStringCollection arguments;
         arguments.Add(buffer);
 
-        throw new MgNullPropertyValueException(L"MgdProxyDataReader.GetProperty",
+        throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdProxyDataReader.GetProperty",
             __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/RasterHelper.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/RasterHelper.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/RasterHelper.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MgDesktop.h"
 #include "RasterHelper.h"
 
@@ -209,7 +226,7 @@
     else if (NULL != (MgdGwsFeatureReader*)m_gwsReader)
         ret = m_gwsReader->GetRaster(propName, xSize, ySize);
     else
-        throw new MgInvalidOperationException(L"MgdRasterHelper::GetRaster", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdRasterHelper::GetRaster", __LINE__, __WFILE__, NULL, L"", NULL);
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgdRasterHelper::GetRaster")
     return ret.Detach();
 }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/RasterHelper.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/RasterHelper.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/RasterHelper.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_RASTER_HELPER_H
 #define DESKTOP_RASTER_HELPER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/RdbmsFeatureSourceParams.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/RdbmsFeatureSourceParams.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/RdbmsFeatureSourceParams.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "RdbmsFeatureSourceParams.h"
 
 MgdRdbmsFeatureSourceParams::MgdRdbmsFeatureSourceParams()

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/RdbmsFeatureSourceParams.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/RdbmsFeatureSourceParams.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/RdbmsFeatureSourceParams.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_RDBMS_FEATURE_SOURCE_PARAMS_H
 #define DESKTOP_RDBMS_FEATURE_SOURCE_PARAMS_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/SpatialContextCacheItem.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/SpatialContextCacheItem.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/SpatialContextCacheItem.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,21 @@
+//
+//  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 "MgDesktop.h"
 #include "SpatialContextCacheItem.h"
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/SpatialContextCacheItem.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/SpatialContextCacheItem.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/SpatialContextCacheItem.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_SPATIAL_CONTEXT_CACHE_ITEM_H
 #define DESKTOP_SPATIAL_CONTEXT_CACHE_ITEM_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/TransformCache.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/TransformCache.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/TransformCache.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,21 @@
+//
+//  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 "TransformCache.h"
 
 ACE_Recursive_Thread_Mutex MgdTransformCache::sm_mutex;

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/TransformCache.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/TransformCache.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Feature/TransformCache.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_TRANSFORM_CACHE
 #define DESKTOP_TRANSFORM_CACHE
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/FeatureReader.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/FeatureReader.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/FeatureReader.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "FeatureReader.h"
 #include "Services/Feature/FeatureDefs.h"
 #include "Services/Feature/FeatureConnection.h"
@@ -55,7 +72,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdFeatureReader::GetBoolean",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureReader::GetBoolean",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -80,7 +97,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdFeatureReader::GetByte",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureReader::GetByte",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -107,7 +124,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdFeatureReader::GetDateTime",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureReader::GetDateTime",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -132,7 +149,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdFeatureReader::GetSingle",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureReader::GetSingle",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -157,7 +174,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdFeatureReader::GetDouble",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureReader::GetDouble",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -182,7 +199,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdFeatureReader::GetInt16",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureReader::GetInt16",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -207,7 +224,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdFeatureReader::GetInt32",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureReader::GetInt32",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -232,7 +249,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdFeatureReader::GetInt64",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureReader::GetInt64",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -262,7 +279,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdFeatureReader::GetString",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureReader::GetString",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -298,7 +315,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdFeatureReader::GetBLOB",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureReader::GetBLOB",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -334,7 +351,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdFeatureReader::GetCLOB",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureReader::GetCLOB",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -368,7 +385,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdFeatureReader::GetGeometry",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureReader::GetGeometry",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -400,7 +417,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdFeatureReader::GetGeometry",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureReader::GetGeometry",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -460,7 +477,7 @@
     {
         // TODO: specify which argument and message, once we have the mechanism
         STRING message = MgdFeatureUtil::GetMessage(L"MgMissingRasterProperty");
-        throw new MgInvalidOperationException(L"MgdFeatureReader::GetRaster", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidOperationException, L"MgdFeatureReader::GetRaster", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     // There can be more than one Raster property
@@ -643,7 +660,7 @@
 
 MgByteReader* MgdFeatureReader::ToXml() 
 { 
-    throw new MgNotImplementedException(L"MgdFeatureReader::ToXml", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgdFeatureReader::ToXml", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 //INTERNAL_API:
@@ -679,7 +696,7 @@
         MgStringCollection arguments;
         arguments.Add(propertyName);
 
-        throw new MgNullPropertyValueException(L"MgdFeatureReader::GetString",
+        throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureReader::GetString",
             __LINE__, __WFILE__, &arguments, L"", NULL);
     }
     else
@@ -698,12 +715,12 @@
 
 void MgdFeatureReader::Serialize(MgStream* stream) 
 { 
-    throw new MgNotImplementedException(L"MgdFeatureReader::Serialize", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgdFeatureReader::Serialize", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 void MgdFeatureReader::Deserialize(MgStream* stream) 
 { 
-    throw new MgNotImplementedException(L"MgdFeatureReader::Deserialize", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgdFeatureReader::Deserialize", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 //MgFeatureReader
@@ -853,7 +870,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdFeatureReader::GetFeatureObject",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdFeatureReader::GetFeatureObject",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -883,7 +900,7 @@
 
 MgFeatureSet* MgdFeatureReader::GetFeatures(INT32 count) 
 { 
-    throw new MgNotImplementedException(L"MgdFeatureReader::GetFeatures", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgdFeatureReader::GetFeatures", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 FdoIFeatureReader* MgdFeatureReader::GetInternalReader()

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/FeatureReader.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/FeatureReader.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/FeatureReader.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_FEATURE_READER_H
 #define DESKTOP_FEATURE_READER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/FeatureService.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/FeatureService.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/FeatureService.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "FSDSAX2Parser.h"
 #include "FeatureService.h"
 #include "ResourceService.h"
@@ -1091,7 +1108,7 @@
             MgStringProperty* sp = static_cast<MgStringProperty*>(prop.p);
             MgStringCollection args;
             args.Add(sp->GetValue());
-            throw new MgFdoException(L"MgdFeatureService::InsertFeatures", __LINE__, __WFILE__, &args, L"MgFormatInnerExceptionMessage", NULL);
+            throw new MgException(MgExceptionCodes::MgFdoException, L"MgdFeatureService::InsertFeatures", __LINE__, __WFILE__, &args, L"MgFormatInnerExceptionMessage", NULL);
         }
         else if (prop->GetPropertyType() == MgPropertyType::Feature) //Insert result
         {
@@ -1155,7 +1172,7 @@
             MgStringProperty* sp = static_cast<MgStringProperty*>(prop.p);
             MgStringCollection args;
             args.Add(sp->GetValue());
-            throw new MgFdoException(L"MgdFeatureService::InsertFeatures", __LINE__, __WFILE__, &args, L"MgFormatInnerExceptionMessage", NULL);
+            throw new MgException(MgExceptionCodes::MgFdoException, L"MgdFeatureService::InsertFeatures", __LINE__, __WFILE__, &args, L"MgFormatInnerExceptionMessage", NULL);
         }
         else if (prop->GetPropertyType() == MgPropertyType::Feature) //Insert result
         {
@@ -1491,7 +1508,7 @@
 
     CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::ExecuteSqlQuery");
     if (sqlStatement.empty())
-        throw new MgInvalidArgumentException(L"MgdFeatureService::ExecuteSqlQuery", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdFeatureService::ExecuteSqlQuery", __LINE__, __WFILE__, NULL, L"", NULL);
 
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 2);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
@@ -1583,7 +1600,7 @@
 
     CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::ExecuteSqlQuery");
     if (sqlStatement.empty())
-        throw new MgInvalidArgumentException(L"MgdFeatureService::ExecuteSqlQuery", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdFeatureService::ExecuteSqlQuery", __LINE__, __WFILE__, NULL, L"", NULL);
 
     CHECKARGUMENTNULL(params, L"MgdFeatureService::ExecuteSqlQuery");
     CHECKARGUMENTNULL(trans, L"MgdFeatureService::ExecuteSqlQuery");
@@ -1607,7 +1624,7 @@
 
     CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::ExecuteSqlNonQuery");
     if (sqlNonSelectStatement.empty())
-        throw new MgInvalidArgumentException(L"MgdFeatureService::ExecuteSqlNonQuery", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdFeatureService::ExecuteSqlNonQuery", __LINE__, __WFILE__, NULL, L"", NULL);
 
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 4);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
@@ -1657,7 +1674,7 @@
 
     CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::ExecuteSqlNonQuery");
     if (sqlNonSelectStatement.empty())
-        throw new MgInvalidArgumentException(L"MgdFeatureService::ExecuteSqlNonQuery", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdFeatureService::ExecuteSqlNonQuery", __LINE__, __WFILE__, NULL, L"", NULL);
 
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 2);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
@@ -1786,7 +1803,7 @@
 
     CHECK_FEATURE_SOURCE_ARGUMENT(resource, L"MgdFeatureService::SetLongTransaction");
     if (longTransactionName.empty())
-        throw new MgNullArgumentException(L"MgdFeatureService::SetLongTransaction", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdFeatureService::SetLongTransaction", __LINE__, __WFILE__, NULL, L"", NULL);
 
     MG_LOG_OPERATION_MESSAGE_INIT(MG_API_VERSION(1, 0, 0), 2);
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
@@ -2235,7 +2252,7 @@
     Ptr<MgClassDefinitionCollection> classDefs = describe.GetIdentityProperties(resource, schemaName, classNames);
     if (classDefs->GetCount() != 1)
     {
-        throw new MgClassNotFoundException(L"MgdFeatureService::GetIdentityProperties", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgClassNotFoundException, L"MgdFeatureService::GetIdentityProperties", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     Ptr<MgClassDefinition> classDef = classDefs->GetItem(0);
     propDefs = classDef->GetIdentityProperties();

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ImageFormats.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ImageFormats.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ImageFormats.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "ImageFormats.h"
 
 ///////////////////////////////////////////////////////////////////////////////

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ImageFormats.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ImageFormats.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ImageFormats.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_IMAGE_FORMATS_H
 #define DESKTOP_IMAGE_FORMATS_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/MappingService.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/MappingService.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/MappingService.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MappingService.h"
 #include "EPlotRenderer.h"
 #include "FeatureTypeStyleVisitor.h"
@@ -27,7 +44,7 @@
     }                                                                       \
     catch (exception& e)                                                    \
     {                                                                       \
-        mgException = MgSystemException::Create(e, methodName, __LINE__, __WFILE__); \
+        mgException = MgException::Create(e, methodName, __LINE__, __WFILE__); \
     }                                                                       \
     catch (FdoException* e)                                                 \
     {                                                                       \
@@ -41,11 +58,12 @@
             arguments.Add(buf);                                             \
         }                                                                   \
         FDO_SAFE_RELEASE(e);                                                \
-        mgException = new MgFdoException(methodName, __LINE__, __WFILE__, NULL, messageId, &arguments, nativeErrorCode); \
+        mgException = new MgException(MgExceptionCodes::MgFdoException, methodName, __LINE__, __WFILE__, NULL, messageId, &arguments); \
+        mgException->SetNativeErrorCode(nativeErrorCode);                   \
     }                                                                       \
     catch (...)                                                             \
     {                                                                       \
-        mgException = new MgUnclassifiedException(methodName, __LINE__, __WFILE__, NULL, L"", NULL); \
+        mgException = new MgException(MgExceptionCodes::MgUnclassifiedException, methodName, __LINE__, __WFILE__, NULL, L"", NULL); \
     }                                                                       \
 
 #define MG_SERVER_MAPPING_SERVICE_THROW()                                     \
@@ -176,7 +194,7 @@
 
     if (0 == resource)
     {
-        throw new MgNullArgumentException(
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, 
             L"MgdMappingService::GenerateLegendImage", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -326,7 +344,7 @@
 
     if (NULL == map  || NULL == dwfVersion || NULL == plotSpec )
     {
-        throw new MgNullArgumentException(
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, 
             L"MgdMappingService::GeneratePlot", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -398,7 +416,7 @@
 
     if (NULL == map  || NULL == center || NULL == dwfVersion || NULL == plotSpec )
     {
-        throw new MgNullArgumentException(
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, 
             L"MgdMappingService::GeneratePlot", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -470,7 +488,7 @@
 
     if (NULL == map  || NULL == extents || NULL == plotSpec || NULL == dwfVersion )
     {
-        throw new MgNullArgumentException(
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, 
             L"MgdMappingService::GeneratePlot", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -481,7 +499,7 @@
     Ptr<MgCoordinate> ur = new MgCoordinateXY(oldur->GetX(), oldur->GetY());
     if (ll == NULL || ur == NULL)
     {
-        throw new MgNullArgumentException(L"MgdMappingService::GeneratePlot", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdMappingService::GeneratePlot", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     Ptr<MgEnvelope> env = new MgEnvelope(ll, ur);
 
@@ -492,7 +510,7 @@
     Ptr<MgdMapPlotCollection> mapPlots = new MgdMapPlotCollection();
     if (mapPlot == NULL || mapPlots == NULL)
     {
-        throw new MgNullArgumentException(L"MgdMappingService::GeneratePlot", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdMappingService::GeneratePlot", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     mapPlots->Add(mapPlot);
 
@@ -566,7 +584,7 @@
 
     if (0 == mapPlots || 0 == dwfVersion)
     {
-        throw new MgNullArgumentException(
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, 
             L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -591,19 +609,19 @@
         Ptr<MgdMapPlot> mapPlot = mapPlots->GetItem(nMapPlotIndex);
         if (NULL == mapPlot)
         {
-            throw new MgNullReferenceException(L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         Ptr<MgdMap> map = mapPlot->GetMap();
         if (NULL == map)
         {
-            throw new MgNullReferenceException(L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         Ptr<MgdPlotSpecification> plotSpec = mapPlot->GetPlotSpecification();
         if (NULL == plotSpec)
         {
-            throw new MgNullReferenceException(L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         Ptr<MgdLayout> layout = mapPlot->GetLayout();
@@ -626,7 +644,7 @@
         Ptr<MgEnvelope> env = map->GetDataExtent();
         if (env == NULL)
         {
-            throw new MgNullReferenceException(L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         Ptr<MgCoordinate> ll = env->GetLowerLeftCoordinate();
@@ -633,7 +651,7 @@
         Ptr<MgCoordinate> ur = env->GetUpperRightCoordinate();
         if (ll == NULL || ur == NULL)
         {
-            throw new MgNullReferenceException(L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         RS_Bounds b(ll->GetX(), ll->GetY(), ur->GetX(), ur->GetY());
 
@@ -644,7 +662,7 @@
             Ptr<MgEnvelope> env2 = map->GetMapExtent();
             if (env2 == NULL)
             {
-                throw new MgNullReferenceException(L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
             }
 
             Ptr<MgCoordinate> ll2 = env2->GetLowerLeftCoordinate();
@@ -651,7 +669,7 @@
             Ptr<MgCoordinate> ur2 = env2->GetUpperRightCoordinate();
             if (ll2 == NULL || ur2 == NULL)
             {
-                throw new MgNullReferenceException(L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+                throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
             }
 
             b.minx = ll2->GetX();
@@ -664,7 +682,7 @@
         Ptr<MgdPrintLayout> printLayout = new MgdPrintLayout();
         if (printLayout == NULL)
         {
-            throw new MgNullReferenceException(L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         if (NULL != layout)
@@ -703,10 +721,7 @@
             {
                 dstCs = m_pCSFactory->Create(srs);
             }
-            catch (MgInvalidCoordinateSystemException* e)
-            {
-                e->Release();
-            }
+            MG_CATCH_AND_RELEASE_IF_TYPE(MgInvalidCoordinateSystemException)
         }
 
         double metersPerUnit = (dstCs.p) ? dstCs->ConvertCoordinateSystemUnitsToMeters(1.0) : 1.0;
@@ -717,7 +732,7 @@
         Ptr<MgEnvelope> extents = map->GetMapExtent();
         if (center == NULL || extents == NULL)
         {
-            throw new MgNullReferenceException(L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         switch (mapPlot->GetMapPlotInstruction())
@@ -730,7 +745,7 @@
                     Ptr<MgEnvelope> extents = map->GetDataExtent();
                     if (extents == NULL)
                     {
-                        throw new MgNullReferenceException(L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+                        throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
                     }
                     printLayout->ComputeMapOffsetAndSize(dMapScale, extents, metersPerUnit, dr.mapOffsetX(), dr.mapOffsetY(), dr.mapWidth(), dr.mapHeight());
                     double mapWidth = dr.mapWidth();
@@ -765,7 +780,7 @@
                 Ptr<MgCoordinate> plotur = extents->GetUpperRightCoordinate();
                 if (plotll == NULL || plotur == NULL)
                 {
-                    throw new MgNullReferenceException(L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+                    throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
                 }
                 double minX = plotll->GetX();
                 double minY = plotll->GetY();
@@ -792,12 +807,12 @@
                 center = new MgCoordinateXY(centerX, centerY);
                 if (center == NULL)
                 {
-                    throw new MgNullReferenceException(L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+                    throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
                 }
                 Ptr<MgPoint> centerpt = new MgPoint(center);
                 if (centerpt == NULL)
                 {
-                    throw new MgNullReferenceException(L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+                    throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
                 }
                 map->SetViewCenter(centerpt);
                 break;
@@ -808,7 +823,7 @@
                 arguments.Add(L"1");
                 arguments.Add(L"MgdMapPlotCollection");
 
-                throw new MgInvalidArgumentException(L"MgdMappingService::GenerateMultiPlot",
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdMappingService::GenerateMultiPlot",
                     __LINE__, __WFILE__, &arguments, L"MgInvalidMapPlotCollectionMapPlotInstruction", NULL);
             }
             break;
@@ -876,7 +891,7 @@
         Ptr<MgLayerCollection> layers = map->GetLayers();
         if (layers == NULL)
         {
-            throw new MgNullReferenceException(L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdMappingService::GenerateMultiPlot", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         // Define a polygon to represent the map extents and fill it with the map background color

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ProfilingService.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ProfilingService.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ProfilingService.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "ProfilingService.h"
 #include "ProfileResult.h"
 #include "ProfileRenderMapResult.h"
@@ -24,7 +41,7 @@
     MG_TRY()
 
     if (NULL == map)
-        throw new MgNullArgumentException(L"MgdProfilingService::ProfileRenderDynamicOverlay", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdProfilingService::ProfileRenderDynamicOverlay", __LINE__, __WFILE__, NULL, L"", NULL);
 
     std::unique_ptr<ProfileRenderMapResult> pPRMResult; // a pointer points to Profile Render Map Result
     pPRMResult.reset(new ProfileRenderMapResult());
@@ -66,7 +83,7 @@
     MG_TRY()
 
     if (NULL == map)
-        throw new MgNullArgumentException(L"MgdProfilingService::ProfileRenderMap", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdProfilingService::ProfileRenderMap", __LINE__, __WFILE__, NULL, L"", NULL);
 
     std::unique_ptr<ProfileRenderMapResult> pPRMResult; // a pointer points to Profile Render Map Result
     pPRMResult.reset(new ProfileRenderMapResult());

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/FeatureInfoRenderer.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/FeatureInfoRenderer.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/FeatureInfoRenderer.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "FeatureInfoRenderer.h"
 #include "KeyEncode.h"
 #include "RSMgFeatureReader.h"

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/FeatureInfoRenderer.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/FeatureInfoRenderer.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/FeatureInfoRenderer.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_FEATURE_INFO_RENDERER_H
 #define DESKTOP_FEATURE_INFO_RENDERER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/LegendPlotUtil.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/LegendPlotUtil.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/LegendPlotUtil.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "LegendPlotUtil.h"
 #include "MappingUtil.h"
 
@@ -52,7 +69,7 @@
 {
     if (NULL == map || NULL == legendSpec)
     {
-        throw new MgNullArgumentException(
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, 
             L"MgdLegendPlotUtil.AddLegendElement", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -1028,7 +1045,7 @@
             arguments.Add(L"1");
             arguments.Add(pageUnits);
 
-            throw new MgInvalidArgumentException(L"MgdLegendPlotUtil.AddCustomLogoElement",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdLegendPlotUtil.AddCustomLogoElement",
                 __LINE__, __WFILE__, &arguments, L"MgInvalidPrintLayoutPageSizeUnits", NULL);
         }
     }
@@ -1065,7 +1082,7 @@
         else
         {
             // invalid positionUnits specified
-            throw new MgdInvalidPrintLayoutPositionUnitsException(L"MgdLegendPlotUtil.AddCustomLogoElement",
+            throw new MgException(MgExceptionCodes::MgInvalidPrintLayoutPositionUnitsException, L"MgdLegendPlotUtil.AddCustomLogoElement",
                 __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
@@ -1104,7 +1121,7 @@
         else
         {
             // invalid positionUnits specified - should never get here
-            throw new MgdInvalidPrintLayoutPositionUnitsException(L"MgdLegendPlotUtil.AddCustomLogoElement",
+            throw new MgException(MgExceptionCodes::MgInvalidPrintLayoutPositionUnitsException, L"MgdLegendPlotUtil.AddCustomLogoElement",
                 __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
@@ -1128,7 +1145,7 @@
         else
         {
             // invalid positionUnits specified
-            throw new MgdInvalidPrintLayoutPositionUnitsException(L"MgdLegendPlotUtil.AddCustomLogoElement",
+            throw new MgException(MgExceptionCodes::MgInvalidPrintLayoutPositionUnitsException, L"MgdLegendPlotUtil.AddCustomLogoElement",
                 __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
@@ -1145,7 +1162,7 @@
         else
         {
             // invalid units specified - should never get here
-            throw new MgdInvalidPrintLayoutSizeUnitsException(L"MgdLegendPlotUtil.AddCustomLogoElement",
+            throw new MgException(MgExceptionCodes::MgInvalidPrintLayoutSizeUnitsException, L"MgdLegendPlotUtil.AddCustomLogoElement",
                 __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
@@ -1188,7 +1205,7 @@
             arguments.Add(L"1");
             arguments.Add(pageUnits);
 
-            throw new MgInvalidArgumentException(L"MgdLegendPlotUtil.AddCustomTextElement",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdLegendPlotUtil.AddCustomTextElement",
                 __LINE__, __WFILE__, &arguments, L"MgInvalidPrintLayoutPageSizeUnits", NULL);
         }
     }
@@ -1230,7 +1247,7 @@
         else
         {
             // invalid positionUnits specified
-            throw new MgdInvalidPrintLayoutPositionUnitsException(L"MgdLegendPlotUtil.AddCustomLogoElement", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidPrintLayoutPositionUnitsException, L"MgdLegendPlotUtil.AddCustomLogoElement", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         if (positionUnits == L"percent")  // NOXLATE
@@ -1268,7 +1285,7 @@
         else
         {
             // invalid positionUnits specified - should never get here
-            throw new MgdInvalidPrintLayoutPositionUnitsException(L"MgdLegendPlotUtil.AddCustomLogoElement", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidPrintLayoutPositionUnitsException, L"MgdLegendPlotUtil.AddCustomLogoElement", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         double textSize = 0.0;
@@ -1292,7 +1309,7 @@
         else
         {
             // invalid positionUnits specified
-            throw new MgdInvalidPrintLayoutFontSizeUnitsException(L"MgdLegendPlotUtil.AddCustomTextElement", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidPrintLayoutFontSizeUnitsException, L"MgdLegendPlotUtil.AddCustomTextElement", __LINE__, __WFILE__, NULL, L"", NULL);
         }
 
         if (sizeUnits == L"inches")  // NOXLATE
@@ -1310,7 +1327,7 @@
         else
         {
             // invalid units specified
-            throw new MgdInvalidPrintLayoutFontSizeUnitsException(L"MgdLegendPlotUtil.AddCustomTextElement", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidPrintLayoutFontSizeUnitsException, L"MgdLegendPlotUtil.AddCustomTextElement", __LINE__, __WFILE__, NULL, L"", NULL);
         }
         fontName = textInfo.GetFontName();
         fontHeight = textSize;

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/LegendPlotUtil.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/LegendPlotUtil.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/LegendPlotUtil.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_LEGEND_PLOT_UTIL_H
 #define DESKTOP_LEGEND_PLOT_UTIL_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/MapPlot.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/MapPlot.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/MapPlot.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -32,7 +32,7 @@
 {
     if (NULL == map || NULL == plotSpec)
     {
-        throw new MgNullArgumentException(L"MgdMapPlot.MgdMapPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdMapPlot.MgdMapPlot", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     Initialize();
@@ -51,7 +51,7 @@
 {
     if (NULL == map || NULL == center || NULL == plotSpec)
     {
-        throw new MgNullArgumentException(L"MgdMapPlot.MgdMapPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdMapPlot.MgdMapPlot", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     Initialize();
@@ -73,7 +73,7 @@
 {
     if (map == NULL || extent == NULL || plotSpec == NULL)
     {
-        throw new MgNullArgumentException(L"MgdMapPlot.MgdMapPlot", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdMapPlot.MgdMapPlot", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     Initialize();
@@ -242,7 +242,7 @@
 // Serialize data to TCP/IP stream
 void MgdMapPlot::Serialize(MgStream* stream)
 {
-    throw new MgNotImplementedException(L"MgdMapPlot.Serialize", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgdMapPlot.Serialize", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 
@@ -250,7 +250,7 @@
 // Deserialize data from TCP/IP stream
 void MgdMapPlot::Deserialize(MgStream* stream)
 {
-    throw new MgNotImplementedException(L"MgdMapPlot.Deserialize", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgdMapPlot.Deserialize", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/MappingDefs.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/MappingDefs.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/MappingDefs.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_MAPPING_DEFS_H
 #define DESKTOP_MAPPING_DEFS_H
 
@@ -23,7 +40,7 @@
     }                                                                       \
     catch (exception& e)                                                    \
     {                                                                       \
-        mgException = MgSystemException::Create(e, methodName, __LINE__, __WFILE__); \
+        mgException = MgException::Create(e, methodName, __LINE__, __WFILE__); \
     }                                                                       \
     catch (FdoException* e)                                                 \
     {                                                                       \
@@ -37,11 +54,12 @@
             arguments.Add(buf);                                             \
         }                                                                   \
         FDO_SAFE_RELEASE(e);                                                \
-        mgException = new MgFdoException(methodName, __LINE__, __WFILE__, NULL, messageId, &arguments, nativeErrorCode); \
+        mgException = new MgException(MgExceptionCodes::MgFdoException, methodName, __LINE__, __WFILE__, NULL, messageId, &arguments); \
+        mgException->SetNativeErrorCode(nativeErrorCode);                   \
     }                                                                       \
     catch (...)                                                             \
     {                                                                       \
-        mgException = new MgUnclassifiedException(methodName, __LINE__, __WFILE__, NULL, L"", NULL); \
+        mgException = new MgException(MgExceptionCodes::MgUnclassifiedException, methodName, __LINE__, __WFILE__, NULL, L"", NULL); \
     }                                                                       \
 
 #define MG_SERVER_MAPPING_SERVICE_THROW()                                     \

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/MappingUtil.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/MappingUtil.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/MappingUtil.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MappingUtil.h"
 #include "MappingDefs.h"
 
@@ -49,7 +66,7 @@
         STRING errorMsg = parser.GetErrorMessage();
         MgStringCollection arguments;
         arguments.Add(errorMsg);
-        throw new MgInvalidMapDefinitionException(L"MgdMappingUtil::GetMapDefinition", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidMapDefinitionException, L"MgdMappingUtil::GetMapDefinition", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     // detach the map definition from the parser - it's
@@ -873,8 +890,8 @@
             MgStringCollection argumentsWhy;
             argumentsWhy.Add(mgException->GetExceptionMessage(locale));
 
-            Ptr<MgdStylizeLayerFailedException> exception;
-            exception = new MgdStylizeLayerFailedException(L"MgdMappingUtil.StylizeLayers", __LINE__, __WFILE__, &arguments, L"MgFormatInnerExceptionMessage", &argumentsWhy);
+            Ptr<MgException> exception;
+            exception = new MgException(MgExceptionCodes::MgStylizeLayerFailedException, L"MgdMappingUtil.StylizeLayers", __LINE__, __WFILE__, &arguments, L"MgFormatInnerExceptionMessage", &argumentsWhy);
 
             STRING message = exception->GetExceptionMessage(locale);
             STRING stackTrace = exception->GetStackTrace(locale);
@@ -1271,7 +1288,8 @@
         arguments.Add(buf);
     }
 
-    mgException = new MgFdoException(L"MgStylizationUtil.ExceptionTrap", line, file, NULL, messageId, &arguments, nativeErrorCode);
+    mgException = new MgException(MgExceptionCodes::MgFdoException, L"MgStylizationUtil.ExceptionTrap", line, file, NULL, messageId, &arguments);
+    mgException->SetNativeErrorCode(nativeErrorCode);
 
     MG_CATCH(L"MgStylizationUtil.ExceptionTrap")
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/MappingUtil.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/MappingUtil.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/MappingUtil.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_MAPPING_UTIL_H
 #define DESKTOP_MAPPING_UTIL_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/PlotSpecification.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/PlotSpecification.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/PlotSpecification.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "PlotSpecification.h"
 
 MG_IMPL_DYNCREATE(MgdPlotSpecification)

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/PrintLayout.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/PrintLayout.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/PrintLayout.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -74,7 +74,7 @@
 
     if (0 == resourceService || 0 == layoutDefinition)
     {
-        throw new MgNullArgumentException(
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, 
             L"MgdPrintLayout.Create", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -266,7 +266,7 @@
                         && positionUnits != L"meters" && positionUnits != L"inches" && positionUnits != L"percent")
                     {
                         // invalid print layout position units
-                        throw new MgdInvalidPrintLayoutPositionUnitsException(L"MgdPrintLayout.GetLayoutPropertiesFromXml", __LINE__, __WFILE__, NULL, L"", NULL);
+                        throw new MgException(MgExceptionCodes::MgInvalidPrintLayoutPositionUnitsException, L"MgdPrintLayout.GetLayoutPropertiesFromXml", __LINE__, __WFILE__, NULL, L"", NULL);
                     }
                 }
                 pXmlUtil->GetElementValue(logoNode, "ResourceId", resId, false);
@@ -281,7 +281,7 @@
                         && sizeUnits != L"inches" && sizeUnits != L"meters")
                     {
                         // invalid print layout size units
-                        throw new MgdInvalidPrintLayoutSizeUnitsException(L"MgdPrintLayout.GetLayoutPropertiesFromXml", __LINE__, __WFILE__, NULL, L"", NULL);
+                        throw new MgException(MgExceptionCodes::MgInvalidPrintLayoutSizeUnitsException, L"MgdPrintLayout.GetLayoutPropertiesFromXml", __LINE__, __WFILE__, NULL, L"", NULL);
                     }
                 }
                 pXmlUtil->GetElementValue(logoNode, "Rotation", rotation, false);
@@ -328,7 +328,7 @@
                         && positionUnits != L"percent" && positionUnits != L"meters" && positionUnits != L"inches")
                     {
                         // invalid print layout position units
-                        throw new MgdInvalidPrintLayoutPositionUnitsException(L"MgdPrintLayout.GetLayoutPropertiesFromXml", __LINE__, __WFILE__, NULL, L"", NULL);
+                        throw new MgException(MgExceptionCodes::MgInvalidPrintLayoutPositionUnitsException, L"MgdPrintLayout.GetLayoutPropertiesFromXml", __LINE__, __WFILE__, NULL, L"", NULL);
                     }
                 }
                 DOMNode* fontNode = pXmlUtil->GetElementNode(textNode, "Font", false);
@@ -341,7 +341,7 @@
                         && fontSizeUnits != L"points" && fontSizeUnits != L"meters" && fontSizeUnits != L"inches")
                     {
                         // invalid print layout font size units
-                        throw new MgdInvalidPrintLayoutFontSizeUnitsException(L"MgdPrintLayout.GetLayoutPropertiesFromXml", __LINE__, __WFILE__, NULL, L"", NULL);
+                        throw new MgException(MgExceptionCodes::MgInvalidPrintLayoutFontSizeUnitsException, L"MgdPrintLayout.GetLayoutPropertiesFromXml", __LINE__, __WFILE__, NULL, L"", NULL);
                     }
                 }
                 pXmlUtil->GetElementValue(textNode, "Value", value, false);

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgFeatureReader.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgFeatureReader.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgFeatureReader.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "RSMgFeatureReader.h"
 #include "RSMgRaster.h"
 #include "RSMgInputStream.h"
@@ -266,7 +283,7 @@
         STRING message;
         message = ex->GetExceptionMessage();
 
-        bool shouldThrow = (NULL == dynamic_cast<MgFdoException*>(ex));
+        bool shouldThrow = (ex->GetExceptionCode() == MgExceptionCodes::MgFdoException);
         ex->Release();
         if (shouldThrow)
         {

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgFeatureReader.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgFeatureReader.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgFeatureReader.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_RS_FEATURE_READER_H
 #define DESKTOP_RS_FEATURE_READER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgInputStream.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgInputStream.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgInputStream.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_RS_INPUT_STREAM_H
 #define DESKTOP_RS_INPUT_STREAM_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgRaster.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgRaster.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgRaster.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "RSMgRaster.h"
 #include "RSMgInputStream.h"
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgRaster.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgRaster.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgRaster.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_RS_RASTER_H
 #define DESKTOP_RS_RASTER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgSymbolManager.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgSymbolManager.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgSymbolManager.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "RSMgSymbolManager.h"
 #include "RSMgInputStream.h"
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgSymbolManager.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgSymbolManager.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RSMgSymbolManager.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_RS_SYMBOL_MANAGER_H
 #define DESKTOP_RS_SYMBOL_MANAGER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RenderingOptions.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RenderingOptions.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RenderingOptions.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "RenderingOptions.h"
 
 MG_IMPL_DYNCREATE(MgdRenderingOptions)

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RenderingOptions.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RenderingOptions.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Rendering/RenderingOptions.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_RENDERING_OPTIONS_H
 #define DESKTOP_RENDERING_OPTIONS_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/RenderingService.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/RenderingService.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/RenderingService.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "RenderingService.h"
 #include "System/ConfigProperties.h"
 #include "AGGRenderer.h"
@@ -133,7 +150,7 @@
     MG_LOG_TRACE_ENTRY(L"MgdRenderingService::RenderTile()");
 
     if (NULL == map || baseMapLayerGroupName.empty())
-        throw new MgNullArgumentException(L"MgdRenderingService.RenderTile", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdRenderingService.RenderTile", __LINE__, __WFILE__, NULL, L"", NULL);
 
     // find the finite display scale closest to the requested map scale
     double scale = map->GetViewScale();
@@ -141,7 +158,7 @@
 
     // if we don't find a nearest scale then something is wrong with the map
     if (scaleIndex < 0)
-        throw new MgInvalidMapDefinitionException(L"MgdRenderingService.RenderTile", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidMapDefinitionException, L"MgdRenderingService.RenderTile", __LINE__, __WFILE__, NULL, L"", NULL);
 
     // get the layer group associated with the name
     Ptr<MgLayerGroupCollection> layerGroups = map->GetLayerGroups();
@@ -152,7 +169,7 @@
         arguments.Add(L"2");
         arguments.Add(baseMapLayerGroupName);
 
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderTile",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderTile",
             __LINE__, __WFILE__, &arguments, L"MgdMapLayerGroupNameNotFound", NULL);
     }
 
@@ -229,7 +246,7 @@
     MG_TRY()
 
     if (NULL == map || NULL == baseGroup)
-        throw new MgNullArgumentException(L"MgdRenderingService.RenderTile", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdRenderingService.RenderTile", __LINE__, __WFILE__, NULL, L"", NULL);
 
     // get map extent that corresponds to tile extent
     RS_Bounds extent(mcsMinX, mcsMinY, mcsMaxX, mcsMaxY);
@@ -670,7 +687,7 @@
     MG_TRY()
 
     if (NULL == map)
-        throw new MgNullArgumentException(L"MgdRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"", NULL);
 
     // validate map view parameters
     int width            = map->GetDisplayWidth();
@@ -680,23 +697,23 @@
     double metersPerUnit = map->GetMetersPerUnit();
 
     if (width <= 0)
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgdMapDisplayWidthCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgdMapDisplayWidthCannotBeLessThanOrEqualToZero", NULL);
 
     if (height <= 0)
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgdMapDisplayHeightCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgdMapDisplayHeightCannotBeLessThanOrEqualToZero", NULL);
 
     if (dpi <= 0)
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgdMapDisplayDpiCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgdMapDisplayDpiCannotBeLessThanOrEqualToZero", NULL);
 
     if (scale <= 0.0)
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgdMapViewScaleCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgdMapViewScaleCannotBeLessThanOrEqualToZero", NULL);
 
     if (metersPerUnit <= 0.0)
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgdMapMetersPerUnitCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgdMapMetersPerUnitCannotBeLessThanOrEqualToZero", NULL);
 
     // sanity check - number of image pixels cannot exceed MAX_PIXELS
     if (width * height > MAX_PIXELS)
-        throw new MgOutOfRangeException(L"MgdRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgInvalidImageSizeTooBig", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfRangeException, L"MgdRenderingService.RenderDynamicOverlayInternal", __LINE__, __WFILE__, NULL, L"MgInvalidImageSizeTooBig", NULL);
 
     // compute map extent that corresponds to pixel extent
     Ptr<MgPoint> pt          = map->GetViewCenter();
@@ -927,7 +944,7 @@
     MG_TRY()
 
     if (NULL == map)
-        throw new MgNullArgumentException(L"MgdRenderingService.RenderMapPublished", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdRenderingService.RenderMapPublished", __LINE__, __WFILE__, NULL, L"", NULL);
 
     Ptr<MgPoint> pt = map->GetViewCenter();
     Ptr<MgCoordinate> center = pt->GetCoordinate();
@@ -979,7 +996,7 @@
     MG_TRY()
 
     if (NULL == map || extents == NULL || backgroundColor == NULL)
-        throw new MgNullArgumentException(L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"", NULL);
 
     // validate map view parameters
     int dpi              = map->GetDisplayDpi();
@@ -986,16 +1003,16 @@
     double metersPerUnit = map->GetMetersPerUnit();
 
     if (width <= 0)
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapDisplayWidthCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapDisplayWidthCannotBeLessThanOrEqualToZero", NULL);
 
     if (height <= 0)
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapDisplayHeightCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapDisplayHeightCannotBeLessThanOrEqualToZero", NULL);
 
     if (dpi <= 0)
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapDisplayDpiCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapDisplayDpiCannotBeLessThanOrEqualToZero", NULL);
 
     if (metersPerUnit <= 0.0)
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapMetersPerUnitCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapMetersPerUnitCannotBeLessThanOrEqualToZero", NULL);
 
     // compute a view center and scale from the given extents
     // and pass on to the RenderMap that uses center and scale
@@ -1047,7 +1064,7 @@
 
     // sanity check - number of image pixels cannot exceed MAX_PIXELS
     if (drawWidth * drawHeight > MAX_PIXELS)
-        throw new MgOutOfRangeException(L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgInvalidImageSizeTooBig", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfRangeException, L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgInvalidImageSizeTooBig", NULL);
 
     // use the supplied background color
     RS_Color bgcolor(backgroundColor->GetRed(),
@@ -1137,7 +1154,7 @@
     MG_TRY()
 
     if (NULL == map || NULL == center || NULL == backgroundColor)
-        throw new MgNullArgumentException(L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"", NULL);
 
     // validate map view parameters
     int dpi              = map->GetDisplayDpi();
@@ -1144,23 +1161,23 @@
     double metersPerUnit = map->GetMetersPerUnit();
 
     if (width <= 0)
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapDisplayWidthCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapDisplayWidthCannotBeLessThanOrEqualToZero", NULL);
 
     if (height <= 0)
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapDisplayHeightCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapDisplayHeightCannotBeLessThanOrEqualToZero", NULL);
 
     if (dpi <= 0)
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapDisplayDpiCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapDisplayDpiCannotBeLessThanOrEqualToZero", NULL);
 
     if (scale <= 0.0)
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapViewScaleCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapViewScaleCannotBeLessThanOrEqualToZero", NULL);
 
     if (metersPerUnit <= 0.0)
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapMetersPerUnitCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgdMapMetersPerUnitCannotBeLessThanOrEqualToZero", NULL);
 
     // sanity check - number of image pixels cannot exceed MAX_PIXELS
     if (width * height > MAX_PIXELS)
-        throw new MgOutOfRangeException(L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgInvalidImageSizeTooBig", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfRangeException, L"MgdRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgInvalidImageSizeTooBig", NULL);
 
     double unitsPerPixel = METERS_PER_INCH / (double)dpi / metersPerUnit;
     double mapWidth2 = 0.5 * (double)width * unitsPerPixel * scale;
@@ -1276,10 +1293,7 @@
         {
             dstCs = m_pCSFactory->Create(srs);
         }
-        catch (MgInvalidCoordinateSystemException* e)
-        {
-            e->Release();
-        }
+        MG_CATCH_AND_RELEASE_IF_TYPE(MgInvalidCoordinateSystemException)
     }
 
     RS_String units = dstCs.p? dstCs->GetUnits() : L"";
@@ -1403,18 +1417,18 @@
     MG_LOG_TRACE_ENTRY(L"MgdRenderingService::RenderMapLegend()");
 
     if (NULL == map || NULL == backgroundColor)
-        throw new MgNullArgumentException(L"MgdRenderingService.RenderMapLegend", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdRenderingService.RenderMapLegend", __LINE__, __WFILE__, NULL, L"", NULL);
 
     // validate map view parameters
     if (width <= 0)
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderMapLegend", __LINE__, __WFILE__, NULL, L"MgdMapDisplayWidthCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderMapLegend", __LINE__, __WFILE__, NULL, L"MgdMapDisplayWidthCannotBeLessThanOrEqualToZero", NULL);
 
     if (height <= 0)
-        throw new MgInvalidArgumentException(L"MgdRenderingService.RenderMapLegend", __LINE__, __WFILE__, NULL, L"MgdMapDisplayHeightCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdRenderingService.RenderMapLegend", __LINE__, __WFILE__, NULL, L"MgdMapDisplayHeightCannotBeLessThanOrEqualToZero", NULL);
 
     // sanity check - number of image pixels cannot exceed MAX_PIXELS
     if (width * height > MAX_PIXELS)
-        throw new MgOutOfRangeException(L"MgdRenderingService.RenderMapLegend", __LINE__, __WFILE__, NULL, L"MgInvalidImageSizeTooBig", NULL);
+        throw new MgException(MgExceptionCodes::MgOutOfRangeException, L"MgdRenderingService.RenderMapLegend", __LINE__, __WFILE__, NULL, L"MgInvalidImageSizeTooBig", NULL);
 
     RS_Color bgcolor(backgroundColor->GetRed(),
                      backgroundColor->GetGreen(),
@@ -1966,7 +1980,7 @@
             bs->SetMimeType(MgMimeType::Tiff);
     }
     else
-        throw new MgNullReferenceException(L"MgdRenderingService.CreateImage", __LINE__, __WFILE__, NULL, L"MgNoDataFromRenderer", NULL);
+        throw new MgException(MgExceptionCodes::MgNullReferenceException, L"MgdRenderingService.CreateImage", __LINE__, __WFILE__, NULL, L"MgNoDataFromRenderer", NULL);
     
     if(NULL != pPRMResult)
     {
@@ -2004,7 +2018,7 @@
     ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%t) RenderForSelection(): ** START **\n")));
 #endif
     if (NULL == map || (NULL == geometry && featureFilter.empty()))
-        throw new MgNullArgumentException(L"MgServerRenderingService.RenderForSelection", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgServerRenderingService.RenderForSelection", __LINE__, __WFILE__, NULL, L"", NULL);
 
     if (maxFeatures < 0)
     {
@@ -2015,7 +2029,7 @@
         arguments.Add(L"5");
         arguments.Add(buffer);
 
-        throw new MgInvalidArgumentException(L"MgServerRenderingService.RenderForSelection",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgServerRenderingService.RenderForSelection",
             __LINE__, __WFILE__, &arguments, L"MgValueCannotBeLessThanZero", NULL);
     }
 
@@ -2033,19 +2047,19 @@
     double metersPerUnit = map->GetMetersPerUnit();
 
     if (width <= 0)
-        throw new MgInvalidArgumentException(L"MgServerRenderingService.RenderForSelection", __LINE__, __WFILE__, NULL, L"MgMapDisplayWidthCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgServerRenderingService.RenderForSelection", __LINE__, __WFILE__, NULL, L"MgMapDisplayWidthCannotBeLessThanOrEqualToZero", NULL);
 
     if (height <= 0)
-        throw new MgInvalidArgumentException(L"MgServerRenderingService.RenderForSelection", __LINE__, __WFILE__, NULL, L"MgMapDisplayHeightCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgServerRenderingService.RenderForSelection", __LINE__, __WFILE__, NULL, L"MgMapDisplayHeightCannotBeLessThanOrEqualToZero", NULL);
 
     if (dpi <= 0)
-        throw new MgInvalidArgumentException(L"MgServerRenderingService.RenderForSelection", __LINE__, __WFILE__, NULL, L"MgMapDisplayDpiCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgServerRenderingService.RenderForSelection", __LINE__, __WFILE__, NULL, L"MgMapDisplayDpiCannotBeLessThanOrEqualToZero", NULL);
 
     if (scale <= 0.0)
-        throw new MgInvalidArgumentException(L"MgServerRenderingService.RenderForSelection", __LINE__, __WFILE__, NULL, L"MgMapViewScaleCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgServerRenderingService.RenderForSelection", __LINE__, __WFILE__, NULL, L"MgMapViewScaleCannotBeLessThanOrEqualToZero", NULL);
 
     if (metersPerUnit <= 0.0)
-        throw new MgInvalidArgumentException(L"MgServerRenderingService.RenderForSelection", __LINE__, __WFILE__, NULL, L"MgMapMetersPerUnitCannotBeLessThanOrEqualToZero", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgServerRenderingService.RenderForSelection", __LINE__, __WFILE__, NULL, L"MgMapMetersPerUnitCannotBeLessThanOrEqualToZero", NULL);
 
     // compute map extent that corresponds to pixel extent
     Ptr<MgPoint> pt          = map->GetViewCenter();
@@ -2338,18 +2352,20 @@
                     maxFeatures -= numFeaturesProcessed;
                 }
             }
-            catch (MgFdoException* e)
+            catch (MgException* e)
             {
-                //TODO: what should we really be doing in this case?
-                //This can happen if the underlying FDO provider does not
-                //support a particular spatial operation. One way around this
-                //is to select all features which appear on the screen and then
-                //do our own geometry math.
-                #ifdef _DEBUG
-                STRING error = e->GetExceptionMessage();
-                ACE_DEBUG((LM_INFO, ACE_TEXT("(%t) RenderForSelection() - Error: %S\n"), error.c_str()));
-                #endif
-
+                if (e->GetExceptionCode() == MgExceptionCodes::MgFdoException)
+                {
+                    //TODO: what should we really be doing in this case?
+                    //This can happen if the underlying FDO provider does not
+                    //support a particular spatial operation. One way around this
+                    //is to select all features which appear on the screen and then
+                    //do our own geometry math.
+#ifdef _DEBUG
+                    STRING error = e->GetExceptionMessage();
+                    ACE_DEBUG((LM_INFO, ACE_TEXT("(%t) RenderForSelection() - Error: %S\n"), error.c_str()));
+#endif
+                }
                 // Let's throw the exception here, so that it can be recorded in the error log.
                 throw e;
             }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/RenderingService.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/RenderingService.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/RenderingService.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_RENDERING_SERVICE_H
 #define DESKTOP_RENDERING_SERVICE_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ByteSourceDwfInputStreamImpl.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ByteSourceDwfInputStreamImpl.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ByteSourceDwfInputStreamImpl.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "ResourceDefs.h"
 #include "ByteSourceDwfInputStreamImpl.h"
 
@@ -17,7 +34,7 @@
 {
     if (NULL == m_inputStream)
     {
-        throw new MgNullArgumentException(
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, 
             L"MgdByteSourceDwfInputStreamImpl.MgdByteSourceDwfInputStreamImpl",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ByteSourceDwfInputStreamImpl.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ByteSourceDwfInputStreamImpl.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ByteSourceDwfInputStreamImpl.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_BYTE_SOURCE_DWF_INPUT_STREAM_IMPL_H
 #define DESKTOP_BYTE_SOURCE_DWF_INPUT_STREAM_IMPL_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/OperationInfo.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/OperationInfo.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/OperationInfo.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "ResourceDefs.h"
 #include "OperationInfo.h"
 
@@ -49,7 +66,7 @@
         arguments.Add(L"1");
         arguments.Add(MgResources::BlankArgument);
 
-        throw new MgInvalidArgumentException(
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, 
             L"MgOperationInfo.MgOperationInfo",
             __LINE__, __WFILE__, &arguments, L"MgStringEmpty", NULL);
     }
@@ -132,7 +149,7 @@
         MgStringCollection arguments;
         arguments.Add(name);
 
-        throw new MgdParameterNotFoundException(
+        throw new MgException(MgExceptionCodes::MgParameterNotFoundException, 
             L"MgOperationInfo.GetParameter", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
@@ -158,7 +175,7 @@
         MgStringCollection arguments;
         arguments.Add(name);
 
-        throw new MgdDuplicateParameterException(
+        throw new MgException(MgExceptionCodes::MgDuplicateParameterException,
             L"MgOperationInfo.SetParameter", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/OperationInfo.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/OperationInfo.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/OperationInfo.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_OPERATION_INFO_H
 #define DESKTOP_OPERATION_INFO_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/OperationParameter.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/OperationParameter.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/OperationParameter.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "ResourceDefs.h"
 #include "OperationParameter.h"
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/OperationParameter.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/OperationParameter.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/OperationParameter.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_OPERATION_PARAMETER_H
 #define DESKTOP_OPERATION_PARAMETER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourceContentCache.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourceContentCache.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourceContentCache.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MgDesktop.h"
 #include "ResourceContentCache.h"
 
@@ -71,7 +88,7 @@
     CHECKARGUMENTNULL(resource, L"MgdResourceContentCache::PutContentEntry");
     if (content.empty())
     {
-        throw new MgInvalidArgumentException(L"MgdResourceContentCache::PutContentEntry", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdResourceContentCache::PutContentEntry", __LINE__, __WFILE__, NULL, L"", NULL);
     }
     STRING resId = resource->ToString();
     //ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t) MgdResourceContentCache::PutContentEntry - %W\n"), resId.c_str()));

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourceContentCache.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourceContentCache.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourceContentCache.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_RESOURCE_CONTENT_CACHE_H
 #define DESKTOP_RESOURCE_CONTENT_CACHE_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourceDefs.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourceDefs.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourceDefs.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "ResourceDefs.h"
 
 ///////////////////////////////////////////////////////////////////////////////

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourceDefs.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourceDefs.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourceDefs.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_RESOURCE_DEFS_H
 #define DESKTOP_RESOURCE_DEFS_H
 
@@ -54,13 +71,13 @@
     {                                                                         \
         MgStringCollection arguments;                                         \
         arguments.Add(STRING(e.message()));                                   \
-        mgException = new MgdDwfException(methodName, __LINE__, __WFILE__, NULL, L"MgFormatInnerExceptionMessage", &arguments); \
+        mgException = new MgException(MgExceptionCodes::MgDwfException, methodName, __LINE__, __WFILE__, NULL, L"MgFormatInnerExceptionMessage", &arguments); \
     }                                                                         \
     catch (const XMLException& e)                                             \
     {                                                                         \
         MgStringCollection arguments;                                         \
         arguments.Add(X2W(e.getMessage()));                                   \
-        mgException = new MgXmlParserException(methodName, __LINE__, __WFILE__, NULL, L"MgFormatInnerExceptionMessage", &arguments); \
+        mgException = new MgException(MgExceptionCodes::MgXmlParserException, methodName, __LINE__, __WFILE__, NULL, L"MgFormatInnerExceptionMessage", &arguments); \
                                                                               \
     MG_CATCH(methodName)                                                      \
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageHandler.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageHandler.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageHandler.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "ResourceDefs.h"
 #include "ResourcePackageHandler.h"
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageHandler.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageHandler.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageHandler.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_RESOURCE_PACKAGE_HANDLER_H
 #define DESKTOP_RESOURCE_PACKAGE_HANDLER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageLoader.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageLoader.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageLoader.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "ResourceDefs.h"
 #include "ResourcePackageLoader.h"
 
@@ -37,7 +54,7 @@
 
     if (resource == NULL)
     {
-        throw new MgNullArgumentException(
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, 
             L"MgdResourcePackageLoader.CreateResourceIdentifier",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
@@ -46,7 +63,7 @@
 
     if (!resource->IsRepositoryTypeOf(MgRepositoryType::Library))
     {
-        throw new MgInvalidRepositoryTypeException(
+        throw new MgException(MgExceptionCodes::MgInvalidRepositoryTypeException, 
             L"MgdResourcePackageLoader.CreateResourceIdentifier",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageLoader.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageLoader.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageLoader.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_RESOURCE_PACKAGE_LOADER_H
 #define DESKTOP_RESOURCE_PACKAGE_LOADER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageManifestHandler.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageManifestHandler.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageManifestHandler.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "ResourceDefs.h"
 #include "ResourcePackageManifestHandler.h"
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageManifestHandler.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageManifestHandler.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageManifestHandler.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_RESOURCE_PACKAGE_MANIFEST_HANDLER_H
 #define DESKTOP_RESOURCE_PACKAGE_MANIFEST_HANDLER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageManifestParser.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageManifestParser.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageManifestParser.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "ResourceDefs.h"
 #include "ResourcePackageManifestParser.h"
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageManifestParser.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageManifestParser.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ResourcePackageManifestParser.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_RESOURCE_PACKAGE_MANIFEST_PARSER_H
 #define DESKTOP_RESOURCE_PACKAGE_MANIFEST_PARSER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/UnmanagedDataManager.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/UnmanagedDataManager.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/UnmanagedDataManager.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -484,7 +484,7 @@
                     STRING mName = MgUtil::MultiByteToWideChar(mappingName);
                     MgStringCollection args;
                     args.Add(mName);
-                    throw new MgdAliasNotFoundException(L"MgdUnmanagedDataManager::SubstituteDataPathAliases", __LINE__, __WFILE__, &args, L"MgdAliasNotFoundException", NULL);
+                    throw new MgException(MgdExceptionCodes::MgAliasNotFoundException, L"MgdUnmanagedDataManager::SubstituteDataPathAliases", __LINE__, __WFILE__, &args, L"MgdAliasNotFoundException", NULL);
                 }
             }
             break;
@@ -534,7 +534,7 @@
             arguments.Add(L"1");
             arguments.Add(path);
 
-            throw new MgInvalidArgumentException(L"MgdUnmanagedDataManager.EnumerateUnmanagedData",
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdUnmanagedDataManager.EnumerateUnmanagedData",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
 
@@ -581,7 +581,7 @@
                 arguments.Add(L"1");
                 arguments.Add(path);
 
-                throw new MgInvalidArgumentException(L"MgdUnmanagedDataManager.EnumerateUnmanagedData",
+                throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdUnmanagedDataManager.EnumerateUnmanagedData",
                     __LINE__, __WFILE__, &arguments, L"", NULL);
             }
         }

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/UnmanagedDataType.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/UnmanagedDataType.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/UnmanagedDataType.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,21 @@
+//
+//  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 "UnmanagedDataType.h"
 
 ///////////////////////////////////////////////////////////////////////////////

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/UnmanagedDataType.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/UnmanagedDataType.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/UnmanagedDataType.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_UNMANAGED_DATA_TYPE_H
 #define DESKTOP_UNMANAGED_DATA_TYPE_H
 /// \ingroup Desktop_Misc_Module

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ZipFileHandler.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ZipFileHandler.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ZipFileHandler.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,21 @@
+//
+//  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 "ResourceDefs.h"
 #include "ZipFileHandler.h"
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ZipFileHandler.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ZipFileHandler.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ZipFileHandler.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_ZIP_FILE_HANDLER_H
 #define DESKTOP_ZIP_FILE_HANDLER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ZipFileReader.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ZipFileReader.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ZipFileReader.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,21 @@
+//
+//  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 "ResourceDefs.h"
 #include "ZipFileReader.h"
 #include "ByteSourceDwfInputStreamImpl.h"

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ZipFileReader.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ZipFileReader.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Resource/ZipFileReader.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_ZIP_FILE_READER_H
 #define DESKTOP_ZIP_FILE_READER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ResourceService.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ResourceService.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ResourceService.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "ResourceService.h"
 #include "Foundation.h"
 #include "Services/Feature/FeatureServiceCache.h"
@@ -108,7 +125,7 @@
     }
     else 
     {
-        throw new MgInvalidArgumentException(L"MgdResourceService::ResolveContentPath", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdResourceService::ResolveContentPath", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 }
 
@@ -199,7 +216,7 @@
     }
     else 
     {
-        throw new MgInvalidArgumentException(L"MgdResourceService::ResolveDataPath", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdResourceService::ResolveDataPath", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     MgdLogDetail logDetail(MgServiceType::ResourceService, MgdLogDetail::InternalTrace, L"MgdResourceService::ResolveDataPath", mgStackParams);
@@ -353,7 +370,7 @@
                 {
                     MgStringCollection args;
                     args.Add(docElName);
-                    throw new MgInvalidResourceTypeException(L"MgdResourceService::SetResource", __LINE__, __WFILE__, &args, L"", NULL);
+                    throw new MgException(MgExceptionCodes::MgInvalidResourceTypeException, L"MgdResourceService::SetResource", __LINE__, __WFILE__, &args, L"", NULL);
                 }
             }
             else
@@ -362,7 +379,7 @@
                 {
                     MgStringCollection args;
                     args.Add(docElName);
-                    throw new MgInvalidResourceTypeException(L"MgdResourceService::SetResource", __LINE__, __WFILE__, &args, L"", NULL);
+                    throw new MgException(MgExceptionCodes::MgInvalidResourceTypeException, L"MgdResourceService::SetResource", __LINE__, __WFILE__, &args, L"", NULL);
                 }
             }
         }
@@ -393,7 +410,7 @@
             args.Add(colNumStr);
             args.Add(pubIdStr);
             args.Add(sysIdStr);
-            throw new MgXmlParserException(L"MgdResourceService::SetResource", __LINE__, __WFILE__, &args, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgXmlParserException, L"MgdResourceService::SetResource", __LINE__, __WFILE__, &args, L"", NULL);
         }
 
         //Can't rewind a byte sink. So make another one
@@ -534,13 +551,13 @@
     CHECKARGUMENTNULL(destResource, L"MgdResourceService::CopyResource");
 
     if (sourceResource->ToString() == destResource->ToString())
-        throw new MgInvalidArgumentException(L"MgdResourceService::CopyResource", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdResourceService::CopyResource", __LINE__, __WFILE__, NULL, L"", NULL);
 
     if (!ResourceExists(sourceResource))
     {
         MgStringCollection arguments;
         arguments.Add(sourceResource->ToString());
-        throw new MgResourceNotFoundException(L"MgdResourceService::CopyResource", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgResourceNotFoundException, L"MgdResourceService::CopyResource", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     if (ResourceExists(destResource) && !overwrite)
@@ -547,7 +564,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(destResource->ToString());
-        throw new MgDuplicateResourceException(L"MgdResourceService::CopyResource", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgDuplicateResourceException, L"MgdResourceService::CopyResource", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     STRING srcContentPath = ResolveContentPath(sourceResource);
@@ -679,13 +696,13 @@
     STRING dstResId = destResource->ToString();
 
     if (srcResId == dstResId)
-        throw new MgInvalidArgumentException(L"MgdResourceService::MoveResource", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdResourceService::MoveResource", __LINE__, __WFILE__, NULL, L"", NULL);
 
     if (!ResourceExists(sourceResource))
     {
         MgStringCollection arguments;
         arguments.Add(sourceResource->ToString());
-        throw new MgResourceNotFoundException(L"MgdResourceService::MoveResource", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgResourceNotFoundException, L"MgdResourceService::MoveResource", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     STRING srcContentPath = ResolveContentPath(sourceResource);
@@ -794,7 +811,7 @@
     CHECKARGUMENTNULL(data, L"MgdResourceService::SetResourceData");
 
     if (dataName.empty())
-        throw new MgNullArgumentException(L"MgdResourceService::SetResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdResourceService::SetResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
 
     STRING path = ResolveDataPath(resource);
     if (!MgFileUtil::IsDirectory(path))
@@ -841,7 +858,7 @@
     CHECKARGUMENTNULL(resource, L"MgdResourceService::DeleteResourceData");
 
     if (dataName.empty())
-        throw new MgNullArgumentException(L"MgdResourceService::DeleteResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdResourceService::DeleteResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
 
     ReleasePotentialLocks(resource);
     STRING path = ResolveDataPath(resource);
@@ -848,7 +865,7 @@
     path += dataName;
 
     if (!MgFileUtil::IsFile(path))
-        throw new MgResourceDataNotFoundException(L"MgdResourceService::DeleteResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgResourceDataNotFoundException, L"MgdResourceService::DeleteResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
 
     MgFileUtil::DeleteFile(path);
 
@@ -895,20 +912,20 @@
     {
         MgStringCollection arguments;
         arguments.Add(resource->ToString());
-        throw new MgResourceNotFoundException(L"MgdResourceService::RenameResourceData", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgResourceNotFoundException, L"MgdResourceService::RenameResourceData", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     if (oldDataName.empty())
-        throw new MgNullArgumentException(L"MgdResourceService::RenameResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdResourceService::RenameResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
 
     if (newDataName.empty())
-        throw new MgNullArgumentException(L"MgdResourceService::RenameResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdResourceService::RenameResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
 
     STRING path = ResolveDataPath(resource);
 
     STRING src = path + oldDataName;
     if (!MgFileUtil::IsFile(src))
-        throw new MgResourceDataNotFoundException(L"MgdResourceService::RenameResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgResourceDataNotFoundException, L"MgdResourceService::RenameResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
 
     MgFileUtil::RenameFile(path, oldDataName, newDataName, overwrite);
 
@@ -1260,7 +1277,7 @@
         {
             MgStringCollection arguments;
             arguments.Add(resource->ToString());
-            throw new MgResourceNotFoundException(L"MgdResourceService::EnumerateResources", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgResourceNotFoundException, L"MgdResourceService::EnumerateResources", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
 
         if (maxDepth > 0)
@@ -1278,13 +1295,13 @@
         //Conversely this is way easier. Just check for zero depth as it is the only allowed
         //value, and then write the document entry.
         if (depth != 0)
-            throw new MgInvalidArgumentException(L"MgdResourceService::EnumerateResources", __LINE__, __WFILE__, NULL, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdResourceService::EnumerateResources", __LINE__, __WFILE__, NULL, L"", NULL);
 
         if (!MgFileUtil::IsFile(path))
         {
             MgStringCollection arguments;
             arguments.Add(resource->ToString());
-            throw new MgResourceNotFoundException(L"MgdResourceService::EnumerateResources", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgResourceNotFoundException, L"MgdResourceService::EnumerateResources", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
 
         WriteResourceDocumentEntry(xml, resource);
@@ -1337,7 +1354,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(resource->ToString());
-        throw new MgResourceNotFoundException(L"MgdResourceService::EnumerateResourceData", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgResourceNotFoundException, L"MgdResourceService::EnumerateResourceData", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     STRING path = ResolveDataPath(resource);
@@ -1519,7 +1536,7 @@
         MgResourceType::Role == resType ||
         MgResourceType::User == resType)
     {
-        throw new MgInvalidResourceTypeException(L"MgdResourceService::GetResourceContent", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgInvalidResourceTypeException, L"MgdResourceService::GetResourceContent", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //Think of the hard disks. Check we have a cached copy and return that, otherwise
@@ -1533,7 +1550,7 @@
         {
             MgStringCollection arguments;
             arguments.Add(resource->ToString());
-            throw new MgResourceNotFoundException(L"MgdResourceService::GetResourceContent", __LINE__, __WFILE__, &arguments, L"", NULL);
+            throw new MgException(MgExceptionCodes::MgResourceNotFoundException, L"MgdResourceService::GetResourceContent", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
 
         Ptr<MgByteSource> source = new MgByteSource(path);
@@ -1589,17 +1606,17 @@
     {
         MgStringCollection arguments;
         arguments.Add(resource->ToString());
-        throw new MgResourceNotFoundException(L"MgdResourceService::GetResourceData", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgResourceNotFoundException, L"MgdResourceService::GetResourceData", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     if (dataName.empty())
-        throw new MgNullArgumentException(L"MgdResourceService::GetResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdResourceService::GetResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
 
     STRING path = ResolveDataPath(resource);
     path += dataName;
 
     if (!MgFileUtil::IsFile(path))
-        throw new MgResourceDataNotFoundException(L"MgdResourceService::GetResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgResourceDataNotFoundException, L"MgdResourceService::GetResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
 
     Ptr<MgByteSource> source;
 
@@ -1661,7 +1678,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(resource->ToString());
-        throw new MgResourceNotFoundException(L"MgdResourceService::GetResourceData", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgResourceNotFoundException, L"MgdResourceService::GetResourceData", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     STRING path = ResolveDataPath(resource);
@@ -1668,7 +1685,7 @@
     path += MgResourceDataName::UserCredentials;
 
     if (!MgFileUtil::IsFile(path))
-        throw new MgResourceDataNotFoundException(L"MgdResourceService::GetResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgResourceDataNotFoundException, L"MgdResourceService::GetResourceData", __LINE__, __WFILE__, NULL, L"", NULL);
 
     Ptr<MgByteSource> source = new MgByteSource(path);
     blob = source->GetReader();
@@ -1687,7 +1704,7 @@
     {
         MgStringCollection arguments;
         arguments.Add(resource->ToString());
-        throw new MgResourceNotFoundException(L"MgdResourceService::GetResourceModifiedDate", __LINE__, __WFILE__, &arguments, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgResourceNotFoundException, L"MgdResourceService::GetResourceModifiedDate", __LINE__, __WFILE__, &arguments, L"", NULL);
     }
 
     MgDateTime mdt = MgFileUtil::GetFileModificationTime(path);

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ResourceService.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ResourceService.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ResourceService.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_RESOURCE_SERVICE_H
 #define DESKTOP_RESOURCE_SERVICE_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ScrollableFeatureReader.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ScrollableFeatureReader.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ScrollableFeatureReader.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,21 @@
+//
+//  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 "ScrollableFeatureReader.h"
 #include "Services/Feature/FeatureDefs.h"
 #include "Services/Feature/FeatureConnection.h"

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ScrollableFeatureReader.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ScrollableFeatureReader.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ScrollableFeatureReader.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_SCROLLABLE_FEATURE_READER_H
 #define DESKTOP_SCROLLABLE_FEATURE_READER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ServiceFactory.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ServiceFactory.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ServiceFactory.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,21 @@
+//
+//  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 "ServiceFactory.h"
 #include "ResourceService.h"
 #include "FeatureService.h"
@@ -5,7 +23,6 @@
 #include "ProfilingService.h"
 #include "RenderingService.h"
 #include "DrawingService.h"
-#include "Exception/ServiceNotSupportedException.h"
 
 STRING MgdServiceFactory::sm_libContentPath = L"";
 STRING MgdServiceFactory::sm_libDataPath = L"";
@@ -61,7 +78,7 @@
     {
         MgStringCollection args;
         args.Add(sm_schemaPath);
-        throw new MgDirectoryNotFoundException(L"MgdServiceFactory::Initialize", __LINE__, __WFILE__, &args, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgDirectoryNotFoundException, L"MgdServiceFactory::Initialize", __LINE__, __WFILE__, &args, L"", NULL);
     }
 }
 
@@ -88,5 +105,5 @@
     case MgServiceType::TileService:
         return new MgdTileService();
     }
-    throw new MgServiceNotSupportedException(L"MgdServiceFactory::CreateService", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgServiceNotSupportedException, L"MgdServiceFactory::CreateService", __LINE__, __WFILE__, NULL, L"", NULL);
 }
\ No newline at end of file

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ServiceFactory.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ServiceFactory.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/ServiceFactory.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_SERVICE_FACTORY_H
 #define DESKTOP_SERVICE_FACTORY_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/SqlReader.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/SqlReader.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/SqlReader.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,21 @@
+//
+//  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 "SqlReader.h"
 #include "Services/Feature/FeatureConnection.h"
 #include "Services/Feature/FdoConnectionUtil.h"
@@ -56,7 +74,7 @@
     FdoDataType dataType = m_reader->GetColumnType(propertyName.c_str());
     if (FdoDataType(-1) == dataType)
     {
-        throw new MgInvalidPropertyTypeException(L"MgdDataReader.GetPropertyType",
+        throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, L"MgdDataReader.GetPropertyType",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -100,7 +118,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdSqlDataReader::GetBoolean",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdSqlDataReader::GetBoolean",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -125,7 +143,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdSqlDataReader::GetByte",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdSqlDataReader::GetByte",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -152,7 +170,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdSqlDataReader::GetDateTime",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdSqlDataReader::GetDateTime",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -177,7 +195,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdSqlDataReader::GetSingle",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdSqlDataReader::GetSingle",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -202,7 +220,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdSqlDataReader::GetDouble",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdSqlDataReader::GetDouble",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -227,7 +245,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdSqlDataReader::GetInt16",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdSqlDataReader::GetInt16",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -252,7 +270,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdSqlDataReader::GetInt32",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdSqlDataReader::GetInt32",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -277,7 +295,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdSqlDataReader::GetInt64",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdSqlDataReader::GetInt64",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -307,7 +325,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdSqlDataReader::GetString",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdSqlDataReader::GetString",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -516,13 +534,13 @@
 
 MgRaster* MgdSqlDataReader::GetRaster(INT32 index) 
 { 
-    throw new MgInvalidPropertyTypeException(L"MgdSqlDataReader::GetRaster",
+    throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, L"MgdSqlDataReader::GetRaster",
         __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 MgRaster* MgdSqlDataReader::GetRaster(CREFSTRING propertyName) 
 { 
-    throw new MgInvalidPropertyTypeException(L"MgdSqlDataReader::GetRaster",
+    throw new MgException(MgExceptionCodes::MgInvalidPropertyTypeException, L"MgdSqlDataReader::GetRaster",
         __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
@@ -553,7 +571,7 @@
 
 MgByteReader* MgdSqlDataReader::ToXml() 
 { 
-    throw new MgNotImplementedException(L"MgdSqlDataReader::ToXml", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgdSqlDataReader::ToXml", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 //INTERNAL_API:
@@ -606,7 +624,7 @@
             MgStringCollection arguments;
             arguments.Add(propertyName);
 
-            throw new MgNullPropertyValueException(L"MgdSqlDataReader::GetLOB",
+            throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdSqlDataReader::GetLOB",
                 __LINE__, __WFILE__, &arguments, L"", NULL);
         }
         else
@@ -626,7 +644,7 @@
         MgStringCollection arguments;
         arguments.Add(propertyName);
 
-        throw new MgNullPropertyValueException(L"MgdSqlDataReader::GetString",
+        throw new MgException(MgExceptionCodes::MgNullPropertyValueException, L"MgdSqlDataReader::GetString",
             __LINE__, __WFILE__, &arguments, L"", NULL);
     }
     else
@@ -645,10 +663,10 @@
 
 void MgdSqlDataReader::Serialize(MgStream* stream) 
 { 
-    throw new MgNotImplementedException(L"MgdSqlDataReader::Serialize", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgdSqlDataReader::Serialize", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 
 void MgdSqlDataReader::Deserialize(MgStream* stream) 
 { 
-    throw new MgNotImplementedException(L"MgdSqlDataReader::Deserialize", __LINE__, __WFILE__, NULL, L"", NULL);
+    throw new MgException(MgExceptionCodes::MgNotImplementedException, L"MgdSqlDataReader::Deserialize", __LINE__, __WFILE__, NULL, L"", NULL);
 }
\ No newline at end of file

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/SqlReader.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/SqlReader.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/SqlReader.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_SQL_READER_H
 #define DESKTOP_SQL_READER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Stylization/SEMgSymbolManager.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Stylization/SEMgSymbolManager.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Stylization/SEMgSymbolManager.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,21 @@
+//
+//  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 "SEMgSymbolManager.h"
 #include "SAX2Parser.h"
 #include "PlatformBase.h"

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Stylization/SEMgSymbolManager.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Stylization/SEMgSymbolManager.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Stylization/SEMgSymbolManager.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_SE_SYMBOL_MANAGER_H
 #define DESKTOP_SE_SYMBOL_MANAGER_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Tile/TileCache.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Tile/TileCache.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Tile/TileCache.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,21 @@
+//
+//  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 "MgDesktop.h"
 #include "TileDefs.h"
 #include "TileCache.h"

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Tile/TileCache.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Tile/TileCache.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Tile/TileCache.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_TILE_CACHE_H
 #define DESKTOP_TILE_CACHE_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Tile/TileDefs.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Tile/TileDefs.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Tile/TileDefs.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,21 @@
+//
+//  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 "TileDefs.h"
 
 ///////////////////////////////////////////////////////////////////////////////

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Tile/TileDefs.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Tile/TileDefs.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Tile/TileDefs.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_TILE_DEFS_H
 #define DESKTOP_TILE_DEFS_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/TileService.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/TileService.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/TileService.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,21 @@
+//
+//  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 "MgDesktop.h"
 #include "TileService.h"
 
@@ -132,7 +150,7 @@
 
     if (NULL == mapDefinition || baseMapLayerGroupName.empty())
     {
-        throw new MgNullArgumentException(L"MgdTileService.GetTile",
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdTileService.GetTile",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -145,7 +163,7 @@
         arguments.Add(L"5");
         arguments.Add(buffer);
 
-        throw new MgInvalidArgumentException(L"MgdTileService.GetTile",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdTileService.GetTile",
             __LINE__, __WFILE__, &arguments, L"MgInvalidScaleIndex", NULL);
     }
 
@@ -189,7 +207,7 @@
                 MgStringCollection arguments;
                 arguments.Add(lockPathname);
 
-                throw new MgFileIoException(L"MgdTileService.GetTile",
+                throw new MgException(MgExceptionCodes::MgFileIoException, L"MgdTileService.GetTile",
                     __LINE__, __WFILE__, &arguments, L"MgUnableToLockTileFile", NULL);
             }
 
@@ -210,7 +228,7 @@
                 MgStringCollection arguments;
                 arguments.Add(lockPathname);
 
-                throw new MgFileIoException(L"MgdTileService.GetTile",
+                throw new MgException(MgExceptionCodes::MgFileIoException, L"MgdTileService.GetTile",
                     __LINE__, __WFILE__, &arguments, L"MgUnableToOpenLockFile", NULL);
             }
             else
@@ -311,7 +329,7 @@
 
     if (NULL == map || baseMapLayerGroupName.empty())
     {
-        throw new MgNullArgumentException(L"MgdTileService.GetTile",
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdTileService.GetTile",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -322,7 +340,7 @@
     // if we don't find a nearest scale then something is wrong with the map
     if (scaleIndex < 0)
     {
-        throw new MgInvalidMapDefinitionException(L"MgdTileService.GetTile",
+        throw new MgException(MgExceptionCodes::MgInvalidMapDefinitionException, L"MgdTileService.GetTile",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -354,7 +372,7 @@
                 MgStringCollection arguments;
                 arguments.Add(lockPathname);
 
-                throw new MgFileIoException(L"MgdTileService.GetTile",
+                throw new MgException(MgExceptionCodes::MgFileIoException, L"MgdTileService.GetTile",
                     __LINE__, __WFILE__, &arguments, L"MgUnableToLockTileFile", NULL);
             }
 
@@ -375,7 +393,7 @@
                 MgStringCollection arguments;
                 arguments.Add(lockPathname);
 
-                throw new MgFileIoException(L"MgdTileService.GetTile",
+                throw new MgException(MgExceptionCodes::MgFileIoException, L"MgdTileService.GetTile",
                     __LINE__, __WFILE__, &arguments, L"MgUnableToOpenLockFile", NULL);
             }
             else
@@ -465,7 +483,7 @@
 
     if (NULL == img || NULL == map || baseMapLayerGroupName.empty())
     {
-        throw new MgNullArgumentException(L"MgdTileService.SetTile",
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdTileService.SetTile",
             __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
@@ -478,7 +496,7 @@
         arguments.Add(L"3");
         arguments.Add(buffer);
 
-        throw new MgInvalidArgumentException(L"MgdTileService.GetTile",
+        throw new MgException(MgExceptionCodes::MgInvalidArgumentException, L"MgdTileService.GetTile",
             __LINE__, __WFILE__, &arguments, L"MgInvalidScaleIndex", NULL);
     }
 
@@ -504,7 +522,7 @@
             MgStringCollection arguments;
             arguments.Add(lockPathname);
 
-            throw new MgFileIoException(L"MgdTileService.SetTile",
+            throw new MgException(MgExceptionCodes::MgFileIoException, L"MgdTileService.SetTile",
                 __LINE__, __WFILE__, &arguments, L"MgUnableToOpenLockFile", NULL);
         }
         else
@@ -567,7 +585,7 @@
     MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
 
     if (NULL == map)
-        throw new MgNullArgumentException(L"MgdTileService.ClearCache", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgNullArgumentException, L"MgdTileService.ClearCache", __LINE__, __WFILE__, NULL, L"", NULL);
 
     ClearMapCache(resourceId->ToString());
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/TileService.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/TileService.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/TileService.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_TILE_SERVICE_H
 #define DESKTOP_TILE_SERVICE_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Transaction.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Transaction.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Transaction.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,21 @@
+//
+//  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 "Transaction.h"
 #include "Fdo.h"
 #include "Services/Feature/FeatureDefs.h"

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Transaction.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Transaction.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/Services/Transaction.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_TRANSACTION_H
 #define DESKTOP_TRANSACTION_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ClassId.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ClassId.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ClassId.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_CLASSID_H
 #define DESKTOP_CLASSID_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ConfigProperties.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ConfigProperties.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ConfigProperties.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "ConfigProperties.h"
 
 //From UserInformation.h in MapGuideCommon

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ConfigProperties.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ConfigProperties.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ConfigProperties.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_CONFIG_PROPERTIES_H
 #define DESKTOP_CONFIG_PROPERTIES_H
 

Added: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ExceptionCodes.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ExceptionCodes.cpp	                        (rev 0)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ExceptionCodes.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -0,0 +1,20 @@
+//
+//  Copyright (C) 2004-2020 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 "ExceptionCodes.h"
+
+const STRING MgdExceptionCodes::MgAliasNotFoundException = L"MgAliasNotFoundException";

Added: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ExceptionCodes.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ExceptionCodes.h	                        (rev 0)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/ExceptionCodes.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -0,0 +1,27 @@
+//
+//  Copyright (C) 2004-2020 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 DESKTOP_EXCEPTION_CODES_H
+#define DESKTOP_EXCEPTION_CODES_H
+
+class MG_DESKTOP_API MgdExceptionCodes
+{
+PUBLISHED_API:
+    static const STRING MgAliasNotFoundException;    ///\if INTERNAL value("MgAliasNotFoundException") \endif
+};
+
+#endif

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/PlatformInit.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/PlatformInit.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/PlatformInit.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 "MgDesktop.h"
 #include "Log/LogManager.h"
 #include "Fdo.h"
@@ -147,7 +164,7 @@
     if (NULL == hlib)
     {
         ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%t) MgdPlatform::Initialize() - Failed to load FDO library.\n")));
-        throw new MgFdoException(L"MgdPlatform::Initialize",
+        throw new MgException(MgExceptionCodes::MgFdoException, L"MgdPlatform::Initialize",
              __LINE__, __WFILE__, NULL, L"MgFailedToLoadFdoLibrary", NULL);
     }
 
@@ -236,19 +253,5 @@
     fact->Register(MapGuide_Desktop_MapLayer_Layer, MgdLayer::CreateObject);
     fact->Register(MapGuide_Desktop_MapLayer_Selection, MgdSelection::CreateObject);
 
-    EXCEPTION_CLASS_CREATOR(ConnectionFailedException)
-    EXCEPTION_CLASS_CREATOR(DuplicateParameterException)
-    EXCEPTION_CLASS_CREATOR(DwfException)
-    EXCEPTION_CLASS_CREATOR(DwfSectionNotFoundException)
-    EXCEPTION_CLASS_CREATOR(DwfSectionResourceNotFoundException)
-    EXCEPTION_CLASS_CREATOR(InvalidDwfPackageException)
-    EXCEPTION_CLASS_CREATOR(InvalidDwfSectionException)
-    EXCEPTION_CLASS_CREATOR(InvalidFeatureSourceException)
-    EXCEPTION_CLASS_CREATOR(ParameterNotFoundException)
-    EXCEPTION_CLASS_CREATOR(StylizeLayerFailedException)
-    EXCEPTION_CLASS_CREATOR(InvalidPrintLayoutFontSizeUnitsException)
-    EXCEPTION_CLASS_CREATOR(InvalidPrintLayoutPositionUnitsException)
-    EXCEPTION_CLASS_CREATOR(InvalidPrintLayoutSizeUnitsException)
-
     return true;
 }
\ No newline at end of file

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/PlatformInit.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/PlatformInit.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/PlatformInit.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_PLATFORM_INIT_H
 #define DESKTOP_PLATFORM_INIT_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/TimerUtil.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/TimerUtil.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/TimerUtil.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,21 @@
+//
+//  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 "MgDesktop.h"
 #include "TimerUtil.h"
 
@@ -60,6 +78,6 @@
 void MgdTimerUtil::GetFrequency(LARGE_INTEGER* pFrequency)
 {
     if(!QueryPerformanceFrequency(pFrequency))
-        throw new MgUnclassifiedException(L"MgdTimerUtil.GetFrequency", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgException(MgExceptionCodes::MgUnclassifiedException, L"MgdTimerUtil.GetFrequency", __LINE__, __WFILE__, NULL, L"", NULL);
 }
 #endif

Modified: sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/TimerUtil.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/TimerUtil.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/MgDesktop/System/TimerUtil.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -1,3 +1,20 @@
+//
+//  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 DESKTOP_TIMER_UTIL_H
 #define DESKTOP_TIMER_UTIL_H
 

Modified: sandbox/jng/flatten_exceptions/Desktop/UnitTest/CatchHelperMacros.h
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/UnitTest/CatchHelperMacros.h	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/UnitTest/CatchHelperMacros.h	2020-10-22 15:43:37 UTC (rev 9749)
@@ -17,10 +17,19 @@
 
 #include "catch.hpp"
 #define REQUIRE_THROWS_MG(action, extype) \
-    try { \
+    try \
+    { \
         action; \
         FAIL("Expected exception to be thrown"); \
     } \
-    catch (extype ex) { \
-        SAFE_RELEASE(ex); \
+    catch (MgException* ex) \
+    { \
+        if (ex->GetExceptionCode() == MgExceptionCodes::extype) \
+        { \
+            SAFE_RELEASE(ex); \
+        } \
+        else \
+        { \
+            ex->Raise(); \
+        } \
     }

Modified: sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestFeatureService.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestFeatureService.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestFeatureService.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -45,7 +45,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_GetFeatureProviders", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_GetFeatureProviders", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgByteReader> byteReader = pService->GetFeatureProviders();
@@ -85,7 +85,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_TestConnectionSDFProvider", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_TestConnectionSDFProvider", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         const STRING provider = L"OSGeo.SDF";
@@ -129,7 +129,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_GetConnectionPropertyValues", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_GetConnectionPropertyValues", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         STRING provider = L"";
@@ -175,7 +175,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_GetCapabilities", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_GetCapabilities", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         STRING provider = L"OSGeo.SDF";
@@ -221,7 +221,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_TestConnectionResourceIdentifier", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_TestConnectionResourceIdentifier", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier();
@@ -267,7 +267,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_GetSchemas", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_GetSchemas", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier();
@@ -313,7 +313,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_GetClasses", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_GetClasses", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier();
@@ -361,7 +361,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_GetClassDefinition", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_GetClassDefinition", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier();
@@ -429,7 +429,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_GetClassDefinition", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_GetClassDefinition", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier(L"Library://UnitTests/Data/Sheboygan_Parcels.FeatureSource");
@@ -492,7 +492,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_DescribeSchema", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_DescribeSchema", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier();
@@ -541,7 +541,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_DescribeSchema", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_DescribeSchema", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier(L"Library://UnitTests/Data/Sheboygan_Parcels.FeatureSource");
@@ -621,7 +621,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_ApplySchema", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_ApplySchema", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier(L"Library://UnitTests/Data/Empty.FeatureSource");
@@ -880,7 +880,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_SelectFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_SelectFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier();
@@ -933,7 +933,7 @@
         Ptr<MgdFeatureService> pService = dynamic_cast<MgdFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_SelectFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_SelectFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         //Create our test data store
@@ -1058,7 +1058,7 @@
         Ptr<MgdFeatureService> pService = dynamic_cast<MgdFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_SelectFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_SelectFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier();
@@ -1092,12 +1092,22 @@
         keys->Add(keyVal2);
 
         bool bScroll4 = true;
-        try {
+        try 
+        {
             bScroll4 = reader->ReadAt(keys);
-        } catch (MgFdoException* ex) {
-            //If it gets here, it is a defect in the provider as the spec says return false on non-existent record
-            ex->Release();
-            bScroll4 = false;
+        } 
+        catch (MgException* ex) 
+        {
+            if (ex->GetExceptionCode() == MgExceptionCodes::MgFdoException)
+            {
+                //If it gets here, it is a defect in the provider as the spec says return false on non-existent record
+                ex->Release();
+                bScroll4 = false;
+            }
+            else
+            {
+                ex->Raise();
+            }
         }
         bool bScroll5 = reader->ReadAtIndex(0); //indexes are 1-based
         bool bScroll6 = reader->ReadAtIndex(1);
@@ -1151,7 +1161,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_SelectAggregate", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_SelectAggregate", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgDataReader> reader;
@@ -1203,7 +1213,7 @@
         Ptr<MgdFeatureService> pService = dynamic_cast<MgdFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_InsertFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_InsertFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> fsId = new MgResourceIdentifier(L"Library://UnitTests/Data/Sheboygan_Parcels_Writable.FeatureSource");
@@ -1300,12 +1310,12 @@
         Ptr<MgResourceService> pResSvc = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pResSvc == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_InsertFeaturesBatch", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_InsertFeaturesBatch", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
         Ptr<MgdFeatureService> pService = dynamic_cast<MgdFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_InsertFeaturesBatch", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_InsertFeaturesBatch", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         //Set up the feature source
@@ -1513,7 +1523,7 @@
         Ptr<MgdFeatureService> pService = dynamic_cast<MgdFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_UpdateFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_UpdateFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> fsId = new MgResourceIdentifier(L"Library://UnitTests/Data/Sheboygan_Parcels_Writable.FeatureSource");
@@ -1587,7 +1597,7 @@
         Ptr<MgdFeatureService> pService = dynamic_cast<MgdFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_DeleteFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_DeleteFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> fsId = new MgResourceIdentifier(L"Library://UnitTests/Data/Sheboygan_Parcels_Writable.FeatureSource");
@@ -1634,7 +1644,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_ExecuteSqlQuery", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_ExecuteSqlQuery", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier();
@@ -1683,7 +1693,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_ExecuteSqlNonQuery", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_ExecuteSqlNonQuery", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier();
@@ -1731,7 +1741,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_GetSpatialContexts", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_GetSpatialContexts", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier();
@@ -1813,7 +1823,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_GetLongTransactions", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_GetLongTransactions", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier();
@@ -1858,7 +1868,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_SetLongTransaction", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_SetLongTransaction", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         STRING longTransactionName = L"Live";
@@ -1922,7 +1932,7 @@
         Ptr<MgFeatureService> pService = MgdServiceFactory::CreateFeatureService();
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_GetFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_GetFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         STRING readerId = L"0";
@@ -1962,7 +1972,7 @@
         Ptr<MgFeatureService> pService = MgdServiceFactory::CreateFeatureService();
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_CloseFeatureReader", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_CloseFeatureReader", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         STRING readerId = L"0";
@@ -2003,7 +2013,7 @@
         Ptr<MgFeatureService> pService = MgdServiceFactory::CreateFeatureService();
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_GetSqlRows", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_GetSqlRows", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         STRING sqlReader = L"0";
@@ -2043,7 +2053,7 @@
         Ptr<MgFeatureService> pService = MgdServiceFactory::CreateFeatureService();
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_CloseSqlReader", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_CloseSqlReader", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         STRING sqlReader = L"0";
@@ -2085,7 +2095,7 @@
         Ptr<MgFeatureService> pService = MgdServiceFactory::CreateFeatureService();
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_GetRaster", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_GetRaster", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         STRING featureReader = L"0";
@@ -2128,7 +2138,7 @@
         Ptr<MgFeatureService> pService = MgdServiceFactory::CreateFeatureService();
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_GetDataRows", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_GetDataRows", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         STRING dataReader = L"0";
@@ -2168,7 +2178,7 @@
         Ptr<MgFeatureService> pService = MgdServiceFactory::CreateFeatureService();
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_CloseDataReader", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_CloseDataReader", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         STRING dataReader = L"0";
@@ -2210,7 +2220,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_JoinFeatures",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_JoinFeatures",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
@@ -2268,7 +2278,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_JoinFeaturesChainedInner1ToMany",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_JoinFeaturesChainedInner1ToMany",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
@@ -2342,7 +2352,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_ExtendedFeatureClass",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_ExtendedFeatureClass",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
@@ -2522,13 +2532,13 @@
         Ptr<MgdServiceFactory> fact = new MgdServiceFactory();
         if (fact == 0)
         {
-            throw new MgNullReferenceException(L"TestFeatureService.TestCase_SavePoint", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"TestFeatureService.TestCase_SavePoint", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_SavePoint", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_SavePoint", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> featureSource = new MgResourceIdentifier(L"Library://UnitTests/Data/TestInsert.FeatureSource");
@@ -2662,7 +2672,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_JoinFdoFeatures",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_JoinFdoFeatures",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
@@ -2746,7 +2756,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_CreateFeatureSource",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_CreateFeatureSource",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
@@ -2753,7 +2763,7 @@
         Ptr<MgResourceService> pResourceService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pResourceService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_CreateFeatureSource",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_CreateFeatureSource",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
@@ -2850,7 +2860,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(factory->CreateService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_BenchmarkSelectFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_BenchmarkSelectFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier();
@@ -2913,12 +2923,12 @@
         Ptr<MgFeatureService> featSvc = dynamic_cast<MgFeatureService*>(factory->CreateService(MgServiceType::FeatureService));
         if (featSvc == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_SecuredCredentials", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_SecuredCredentials", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
         Ptr<MgdResourceService> resSvc = dynamic_cast<MgdResourceService*>(factory->CreateService(MgServiceType::ResourceService));
         if (resSvc == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_SecuredCredentials", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_SecuredCredentials", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
         
         Ptr<MgResourceIdentifier> fsId = new MgResourceIdentifier(L"Library://UnitTests/Data/SecuredCredentials.FeatureSource");
@@ -3305,13 +3315,13 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService::TestCase_BenchmarkSdfJoin",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService::TestCase_BenchmarkSdfJoin",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
         Ptr<MgFeatureService> featSvc = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (featSvc == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService::TestCase_BenchmarkSdfJoin",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService::TestCase_BenchmarkSdfJoin",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
@@ -3405,13 +3415,13 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService::TestCase_BenchmarkSqliteJoin",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService::TestCase_BenchmarkSqliteJoin",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
         Ptr<MgFeatureService> featSvc = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (featSvc == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService::TestCase_BenchmarkSqliteJoin",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService::TestCase_BenchmarkSqliteJoin",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
@@ -3501,13 +3511,13 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService::TestCase_BenchmarkSqliteAggregateJoin",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService::TestCase_BenchmarkSqliteAggregateJoin",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
         Ptr<MgFeatureService> featSvc = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (featSvc == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService::TestCase_BenchmarkSqliteAggregateJoin",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService::TestCase_BenchmarkSqliteAggregateJoin",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
@@ -3610,13 +3620,13 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService::TestCase_BenchmarkMergeSortJoin",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService::TestCase_BenchmarkMergeSortJoin",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
         Ptr<MgdFeatureService> featSvc = dynamic_cast<MgdFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (featSvc == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService::TestCase_BenchmarkMergeSortJoin",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService::TestCase_BenchmarkMergeSortJoin",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
@@ -3738,13 +3748,13 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService::TestCase_BenchmarkBatchSortedBlockJoin",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService::TestCase_BenchmarkBatchSortedBlockJoin",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
         Ptr<MgdFeatureService> featSvc = dynamic_cast<MgdFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (featSvc == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService::TestCase_BenchmarkBatchSortedBlockJoin",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService::TestCase_BenchmarkBatchSortedBlockJoin",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
@@ -3866,13 +3876,13 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService::TestCase_BenchmarkNestedLoopsSortedBlockJoin",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService::TestCase_BenchmarkNestedLoopsSortedBlockJoin",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
         Ptr<MgdFeatureService> featSvc = dynamic_cast<MgdFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (featSvc == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService::TestCase_BenchmarkNestedLoopsSortedBlockJoin",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService::TestCase_BenchmarkNestedLoopsSortedBlockJoin",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
@@ -4225,13 +4235,13 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService::TestCase_BenchmarkNestedLoopsJoin",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService::TestCase_BenchmarkNestedLoopsJoin",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
         Ptr<MgdFeatureService> featSvc = dynamic_cast<MgdFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (featSvc == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService::TestCase_BenchmarkNestedLoopsJoin",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService::TestCase_BenchmarkNestedLoopsJoin",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
@@ -4358,13 +4368,13 @@
         Ptr<MgdServiceFactory> fact = new MgdServiceFactory();
         if (fact == 0)
         {
-            throw new MgNullReferenceException(L"TestFeatureService.TestCase_UpdateFeaturesPartialFailure", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"TestFeatureService.TestCase_UpdateFeaturesPartialFailure", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgFeatureService> featSvc = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (featSvc == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestCase_UpdateFeaturesPartialFailure",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestCase_UpdateFeaturesPartialFailure",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 

Modified: sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestLogManagerThread.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestLogManagerThread.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestLogManagerThread.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -32,7 +32,7 @@
     MgdLogManager* pMan = MgdLogManager::GetInstance();
     if (nullptr == pMan)
     {
-        throw new MgNullReferenceException(L"TestLogManagerThread.svc", __LINE__, __WFILE__, nullptr, L"", nullptr);
+        throw new MgException(MgExceptionCodes::MgNullReferenceException, L"TestLogManagerThread.svc", __LINE__, __WFILE__, nullptr, L"", nullptr);
     }
 
     INT32 nResult = 0;

Modified: sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestPerformance.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestPerformance.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestPerformance.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -61,13 +61,13 @@
         MgServiceManager* serviceManager = MgServiceManager::GetInstance();
         if(serviceManager == 0)
         {
-            throw new MgNullReferenceException(L"TestPerformance.TestStart", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"TestPerformance.TestStart", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(serviceManager->RequestService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestPerformance.TestStart", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestPerformance.TestStart", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         //Set the user information for the current thread to be administrator
@@ -116,7 +116,7 @@
         MgServiceManager* serviceManager = MgServiceManager::GetInstance();
         if(serviceManager == 0)
         {
-            throw new MgNullReferenceException(L"TestPerformance.TestEnd",
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"TestPerformance.TestEnd",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
@@ -123,7 +123,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(serviceManager->RequestService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestPerformance.TestEnd",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestPerformance.TestEnd",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
@@ -172,13 +172,13 @@
         MgServiceManager* serviceManager = MgServiceManager::GetInstance();
         if(serviceManager == 0)
         {
-            throw new MgNullReferenceException(L"TestPerformance.TestCase_BenchmarkSelectFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"TestPerformance.TestCase_BenchmarkSelectFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(serviceManager->RequestService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestPerformance.TestCase_BenchmarkSelectFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestPerformance.TestCase_BenchmarkSelectFeatures", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgResourceIdentifier> resource = new MgResourceIdentifier();
@@ -242,7 +242,7 @@
         MgServiceManager* serviceManager = MgServiceManager::GetInstance();
         if(serviceManager == 0)
         {
-            throw new MgNullReferenceException(L"TestPerformance.TestCase_BenchmarkJoinFeatures",
+            throw new MgException(MgExceptionCodes::MgNullReferenceException, L"TestPerformance.TestCase_BenchmarkJoinFeatures",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
@@ -249,7 +249,7 @@
         Ptr<MgFeatureService> pService = dynamic_cast<MgFeatureService*>(serviceManager->RequestService(MgServiceType::FeatureService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestPerformance.TestCase_BenchmarkJoinFeatures",
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestPerformance.TestCase_BenchmarkJoinFeatures",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 

Modified: sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestResourceService.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestResourceService.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestResourceService.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -79,7 +79,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_EnumerateRepositories", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_EnumerateRepositories", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         REQUIRE_THROWS_MG(pService->EnumerateRepositories(L"Library"), MgNotImplementedException*);
@@ -105,7 +105,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_CreateRepository", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_CreateRepository", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         REQUIRE_THROWS_MG(pService->CreateRepository(nullptr, nullptr, nullptr), MgNotImplementedException*);
@@ -131,7 +131,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_UpdateRepository", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_UpdateRepository", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         REQUIRE_THROWS_MG(pService->UpdateRepository(nullptr, nullptr, nullptr), MgNotImplementedException*);
@@ -157,7 +157,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_GetRepositoryContent", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_GetRepositoryContent", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
         
         REQUIRE_THROWS_MG(pService->GetRepositoryContent(nullptr), MgNotImplementedException*);
@@ -183,7 +183,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_GetRepositoryHeader", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_GetRepositoryHeader", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         //Try to get repository header using a nullptr argument
@@ -210,7 +210,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_ApplyResourcePackage", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_ApplyResourcePackage", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         //Try using nullptr argument
@@ -245,7 +245,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_DeleteRepository", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_DeleteRepository", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         REQUIRE_THROWS_MG(pService->DeleteRepository(nullptr), MgNotImplementedException*);
@@ -272,7 +272,7 @@
 
         if (nullptr == service)
         {
-            throw new MgServiceNotAvailableException(
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, 
                 L"TestResourceService.TestCase_ResourceExists",
                 __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
@@ -310,7 +310,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_EnumerateResources", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_EnumerateResources", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         //Try to enumerate resources using a nullptr argument
@@ -342,7 +342,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_SetResource", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_SetResource", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgByteSource> contentSource;
@@ -383,7 +383,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_MoveResource", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_MoveResource", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         std::string notXml = "Not XML content";
@@ -460,7 +460,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_MoveResource", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_MoveResource", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         //Try to use nullptr arguments
@@ -512,7 +512,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_CopyResource", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_CopyResource", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         //Try to use nullptr arguments
@@ -549,7 +549,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_GetResourceContent", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_GetResourceContent", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgByteReader> byteReader;
@@ -587,7 +587,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_GetResourceContents", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_GetResourceContents", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         //Try to get the contents using nullptr arguments
@@ -631,7 +631,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_GetResourceHeader", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_GetResourceHeader", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         REQUIRE_THROWS_MG(pService->GetResourceHeader(nullptr), MgNotImplementedException*);
@@ -657,7 +657,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_EnumerateReferences", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_EnumerateReferences", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         REQUIRE_THROWS_MG(pService->EnumerateReferences(nullptr), MgNotImplementedException*);
@@ -683,7 +683,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_ChangeResourceOwner", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_ChangeResourceOwner", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         REQUIRE_THROWS_MG(pService->ChangeResourceOwner(nullptr, L"", false), MgNotImplementedException*);
@@ -709,7 +709,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_InheritPermissionsFrom", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_InheritPermissionsFrom", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         REQUIRE_THROWS_MG(pService->InheritPermissionsFrom(nullptr), MgNotImplementedException*);
@@ -736,7 +736,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_EnumerateResourceData", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_EnumerateResourceData", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgByteReader> byteReader;
@@ -774,7 +774,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_SetResourceData", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_SetResourceData", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgByteSource> dataSource;
@@ -814,7 +814,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_RenameResourceData", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_RenameResourceData", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
         
         //Try using a null argument for the idenfier
@@ -854,7 +854,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_GetResourceData", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_GetResourceData", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgByteReader> byteReader;
@@ -896,7 +896,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_DeleteResourceData", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_DeleteResourceData", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         //Try using a nullptr resource identifier
@@ -933,13 +933,13 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_DeleteResource", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_DeleteResource", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgFeatureService> pFeatureService = dynamic_cast<MgFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (pFeatureService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_DeleteResource", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_DeleteResource", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         //Try to use a nullptr argument
@@ -1025,7 +1025,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_EnumerateUnmanagedData", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_EnumerateUnmanagedData", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         // Try to enumerate mappings
@@ -1054,7 +1054,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_BenchmarkGetResourceContents", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_BenchmarkGetResourceContents", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgStringCollection> resources = new MgStringCollection();
@@ -1140,7 +1140,7 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_PackageNoOpUpdateRepository", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_PackageNoOpUpdateRepository", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
         MgResourceIdentifier resId(L"Library://UnitTests/Package/LineSymbol.SymbolDefinition");
         if (pService->ResourceExists(&resId))
@@ -1171,7 +1171,7 @@
         Ptr<MgdResourceService> pService = dynamic_cast<MgdResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == 0)
         {
-            throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_PackageNoOpUpdateRepository", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestResourceService.TestCase_PackageNoOpUpdateRepository", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         pService->AddAliasMapping(L"MG_TEST", L"C:/Temp");

Modified: sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestServiceFactory.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestServiceFactory.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestServiceFactory.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -70,12 +70,12 @@
         Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
         if (pService == nullptr)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestStart", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestStart", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
         Ptr<MgdFeatureService> featSvc = dynamic_cast<MgdFeatureService*>(fact->CreateService(MgServiceType::FeatureService));
         if (featSvc == nullptr)
         {
-            throw new MgServiceNotAvailableException(L"TestFeatureService.TestStart", __LINE__, __WFILE__, nullptr, L"", nullptr);
+            throw new MgException(MgExceptionCodes::MgServiceNotAvailableException, L"TestFeatureService.TestStart", __LINE__, __WFILE__, nullptr, L"", nullptr);
         }
 
         Ptr<MgCoordinateSystemFactory> csFactory = new MgCoordinateSystemFactory();
@@ -1228,18 +1228,21 @@
                 Ptr<MgResourceIdentifier> wdfres1 = new MgResourceIdentifier(L"Library://UnitTests/Watermarks/PoweredByMapGuide.WatermarkDefinition");
                 pService->DeleteResource(wdfres1);
             }
-            catch (MgFileIoException* e)
-            {
-                STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
-                SAFE_RELEASE(e);
-                ACE_DEBUG((LM_INFO, ACE_TEXT("\nMgFileIoException - Possible file permission error.\nError: %W\n"), message.c_str()));
-            }
             catch (MgException* e)
             {
-                STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
-                message += e->GetStackTrace(TestServiceFactory::TEST_LOCALE);
-                SAFE_RELEASE(e);
-                FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+                if (e->GetExceptionCode() == MgExceptionCodes::MgFileIoException)
+                {
+                    STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
+                    SAFE_RELEASE(e);
+                    ACE_DEBUG((LM_INFO, ACE_TEXT("\nMgFileIoException - Possible file permission error.\nError: %W\n"), message.c_str()));
+                }
+                else
+                {
+                    STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
+                    message += e->GetStackTrace(TestServiceFactory::TEST_LOCALE);
+                    SAFE_RELEASE(e);
+                    FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+                }
             }
             catch (...)
             {
@@ -1381,18 +1384,21 @@
                 Ptr<MgResourceIdentifier> ldfres21 = new MgResourceIdentifier(L"Library://UnitTests/Layers/RailWatermark.LayerDefinition");
                 pService->DeleteResource(ldfres21);
             }
-            catch (MgFileIoException* e)
-            {
-                STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
-                SAFE_RELEASE(e);
-                ACE_DEBUG((LM_INFO, ACE_TEXT("\nMgFileIoException - Possible file permission error.\nError: %W\n"), message.c_str()));
-            }
             catch (MgException* e)
             {
-                STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
-                message += e->GetStackTrace(TestServiceFactory::TEST_LOCALE);
-                SAFE_RELEASE(e);
-                FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+                if (e->GetExceptionCode() == MgExceptionCodes::MgFileIoException)
+                {
+                    STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
+                    SAFE_RELEASE(e);
+                    ACE_DEBUG((LM_INFO, ACE_TEXT("\nMgFileIoException - Possible file permission error.\nError: %W\n"), message.c_str()));
+                }
+                else
+                {
+                    STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
+                    message += e->GetStackTrace(TestServiceFactory::TEST_LOCALE);
+                    SAFE_RELEASE(e);
+                    FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+                }
             }
             catch (...)
             {

Modified: sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestTileService.cpp
===================================================================
--- sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestTileService.cpp	2020-10-21 15:20:56 UTC (rev 9748)
+++ sandbox/jng/flatten_exceptions/Desktop/UnitTest/TestTileService.cpp	2020-10-22 15:43:37 UTC (rev 9749)
@@ -313,16 +313,19 @@
         // set the tile in the cache
         svcTile->SetTile(img, map, scaleIndex, L"BaseLayers", tileCol, tileRow);
     }
-    catch (MgFileIoException* e)
-    {
-        // we sometimes get this due to a sharing error
-        SAFE_RELEASE(e);
-    }
     catch (MgException* e)
     {
-        STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
-        SAFE_RELEASE(e);
-        FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+        if (e->GetExceptionCode() == MgExceptionCodes::MgFileIoException)
+        {
+            // we sometimes get this due to a sharing error
+            SAFE_RELEASE(e);
+        }
+        else
+        {
+            STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
+            SAFE_RELEASE(e);
+            FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+        }
     }
     catch (...)
     {



More information about the mapguide-commits mailing list