[commit] r2506 - trunk/GME/ObjectInspector

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Thu Jul 3 08:12:44 CDT 2014


Author: ksmyth
Date: Thu Jul  3 08:12:44 2014
New Revision: 2506

Log:
ObjectInspector: better error messages when failing to set attributes

Modified:
   trunk/GME/ObjectInspector/Attribute.cpp
   trunk/GME/ObjectInspector/ObjectInspectorCtl.cpp
   trunk/GME/ObjectInspector/StdAfx.cpp

Modified: trunk/GME/ObjectInspector/Attribute.cpp
==============================================================================
--- trunk/GME/ObjectInspector/Attribute.cpp	Thu Jul  3 08:12:34 2014	(r2505)
+++ trunk/GME/ObjectInspector/Attribute.cpp	Thu Jul  3 08:12:44 2014	(r2506)
@@ -494,8 +494,7 @@
 
 					strValue.Replace(_T("\r\n"), _T("\n"));
 
-					CComBSTR bstrValue(strValue);
-					COMTHROW(ccpCurrFCO->put_StrAttrByName(bstrAttrName,bstrValue));					
+					ccpCurrFCO->__SetStrAttrByNameDisp(static_cast<const BSTR>(bstrAttrName), _bstr_t(strValue));					
 				}break;
 			
 				case ITEMDATA_FIXED_LIST:
@@ -508,17 +507,17 @@
 
 				case ITEMDATA_INTEGER:
 					{
-						COMTHROW(ccpCurrFCO->put_IntAttrByName(bstrAttrName,ListItem.Value.intVal));
+						ccpCurrFCO->IntAttrByName[static_cast<const BSTR>(bstrAttrName)] = ListItem.Value.intVal;
 					}break;
 
 				case ITEMDATA_DOUBLE:
 					{
-						COMTHROW(ccpCurrFCO->put_FloatAttrByName(bstrAttrName,ListItem.Value.doubleVal));
+						ccpCurrFCO->FloatAttrByName[static_cast<const BSTR>(bstrAttrName)] = ListItem.Value.doubleVal;
 					}break;
 
 				case ITEMDATA_BOOLEAN:
 					{
-						COMTHROW(ccpCurrFCO->put_BoolAttrByName(bstrAttrName,ListItem.Value.boolVal));
+						ccpCurrFCO->BoolAttrByName[static_cast<const BSTR>(bstrAttrName)] = ListItem.Value.boolVal ? VARIANT_TRUE : VARIANT_FALSE;
 					}break;
 
 				default:

Modified: trunk/GME/ObjectInspector/ObjectInspectorCtl.cpp
==============================================================================
--- trunk/GME/ObjectInspector/ObjectInspectorCtl.cpp	Thu Jul  3 08:12:34 2014	(r2505)
+++ trunk/GME/ObjectInspector/ObjectInspectorCtl.cpp	Thu Jul  3 08:12:44 2014	(r2506)
@@ -910,6 +910,12 @@
 		m_project->AbortTransaction();
 		CWnd::MessageBox(_T("Object Inspector could not write attribute data due to an unexpected error. We apologize for the inconvenience."),_T("Object inspector"),MB_ICONERROR);
 	}
+	catch (_com_error& e)
+	{
+		ASSERT(0);
+		m_project->AbortTransaction();
+		CWnd::MessageBox(CString(L"Object Inspector could not write attribute data: ") + static_cast<const wchar_t*>(e.Description()), L"Object inspector",MB_ICONERROR);
+	}
 
 }
 
@@ -966,6 +972,16 @@
 		else if (e.hr != E_MGA_CONSTRAINT_VIOLATION)
 			CWnd::MessageBox(_T("GME could not write object preference data due to an unexpected MGA error. We apologize for the inconvenience."), _T("GME"), MB_ICONERROR);
 	}
+	catch (_com_error& e)
+	{
+		m_project->AbortTransaction();
+		if(bIsForKind)
+		{
+			ccpMetaProject->AbortTransaction();
+		}
+		if (e.Error() != E_MGA_CONSTRAINT_VIOLATION)
+			CWnd::MessageBox(CString(L"GME could not write attribute data: ") + static_cast<const wchar_t*>(e.Description()), L"GME",MB_ICONERROR);
+	}
 	
 }
 

Modified: trunk/GME/ObjectInspector/StdAfx.cpp
==============================================================================
--- trunk/GME/ObjectInspector/StdAfx.cpp	Thu Jul  3 08:12:34 2014	(r2505)
+++ trunk/GME/ObjectInspector/StdAfx.cpp	Thu Jul  3 08:12:44 2014	(r2506)
@@ -3,3 +3,5 @@
 //  stdafx.obj will contain the pre-compiled type information
 
 #include "stdafx.h"
+
+#import "MgaLib.tlb" implementation_only no_namespace raw_method_prefix("") high_method_prefix("__") no_registry


More information about the gme-commit mailing list