[commit] r2510 - in trunk/GME: Gme Mga

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Fri Jul 11 17:16:07 CDT 2014


Author: ksmyth
Date: Fri Jul 11 17:16:07 2014
New Revision: 2510

Log:
Better error message for: Check for null Kind in Check

Modified:
   trunk/GME/Gme/GMEApp.cpp
   trunk/GME/Mga/MgaCheck.cpp

Modified: trunk/GME/Gme/GMEApp.cpp
==============================================================================
--- trunk/GME/Gme/GMEApp.cpp	Tue Jul  8 16:03:22 2014	(r2509)
+++ trunk/GME/Gme/GMEApp.cpp	Fri Jul 11 17:16:07 2014	(r2510)
@@ -1622,6 +1622,7 @@
 						AfxMessageBox(_T("Upgrade failed, probably due to incompatibility.\n")
 									   _T("You can probably reopen the file without upgrade,\n")
 									   _T("and use the 'Upgrade through XML' function later."));
+						throw_last_com_error(hr);
 					}
 					else readable_only = false;
 					COMTHROW(hr);

Modified: trunk/GME/Mga/MgaCheck.cpp
==============================================================================
--- trunk/GME/Mga/MgaCheck.cpp	Tue Jul  8 16:03:22 2014	(r2509)
+++ trunk/GME/Mga/MgaCheck.cpp	Fri Jul 11 17:16:07 2014	(r2510)
@@ -200,9 +200,12 @@
 			if (!metaf) {
 				_bstr_t name;
 				this->get_Name(name.GetAddress());
-				_bstr_t err = L"'";
-				err += parent->Name + "' contains child '" + name + L"' with no assigned kind";
-				throw_com_error(E_MGA_META_VIOLATION, err);
+				metaref_type metaRef = 0;
+				this->get_MetaRef(&metaRef);
+				int iMetaRef = metaRef;
+				wchar_t buf[512];
+				swprintf_s(buf, L"'%s' contains child '%s' with unknown metaref %d", static_cast<const wchar_t*>(parent->Name), static_cast<const wchar_t*>(name), iMetaRef);
+				throw_com_error(E_MGA_META_VIOLATION, buf);
 			} else if(!parent) {												// root folder
 				CComPtr<IMgaMetaProject> mp;
 				COMTHROW(mgaproject->get_RootMeta(&mp));
@@ -276,9 +279,12 @@
 			if (meta == NULL) {
 				_bstr_t name;
 				this->get_Name(name.GetAddress());
-				_bstr_t err = L"'";
-				err += parent->Name + "' contains child '" + name + L"' with no assigned kind";
-				throw_com_error(E_MGA_META_VIOLATION, err);
+				metaref_type metaRef = 0;
+				this->get_MetaRef(&metaRef);
+				int iMetaRef = metaRef;
+				wchar_t buf[512];
+				swprintf_s(buf, L"'%s' contains child '%s' with unknown metaref %d", static_cast<const wchar_t*>(parent->Name), static_cast<const wchar_t*>(name), iMetaRef);
+				throw_com_error(E_MGA_META_VIOLATION, buf);
 			} else if(parenttyp == OBJTYPE_MODEL) {
 				if(!metarole)  COMTHROW(E_MGA_NO_ROLE);
 				CComPtr<IMgaMetaModel> parentmeta1;


More information about the gme-commit mailing list