[commit] r2689 - in trunk/GME: Meta Parser

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Wed Aug 2 15:54:35 CDT 2017


Author: ksmyth
Date: Wed Aug  2 15:54:35 2017
New Revision: 2689

Log:
Better error message for dup metaref

Modified:
   trunk/GME/Meta/MgaMetaProject.cpp
   trunk/GME/Parser/GenParser.h

Modified: trunk/GME/Meta/MgaMetaProject.cpp
==============================================================================
--- trunk/GME/Meta/MgaMetaProject.cpp	Wed Aug  2 15:54:31 2017	(r2688)
+++ trunk/GME/Meta/MgaMetaProject.cpp	Wed Aug  2 15:54:35 2017	(r2689)
@@ -447,8 +447,12 @@
 {
 	ASSERT( obj != NULL );
 
-	if( metaobj_lookup.find(metaref) != metaobj_lookup.end() )
-		HR_THROW(E_METAREF);
+	if (metaobj_lookup.find(metaref) != metaobj_lookup.end())
+	{
+		wchar_t buf[256];
+		swprintf_s(buf, L"Invalid duplicate metaref '%ld'", metaref);
+		throw_com_error(E_METAREF, buf);
+	}
 
 	if( metaref > max_metaref )
 		max_metaref = metaref;

Modified: trunk/GME/Parser/GenParser.h
==============================================================================
--- trunk/GME/Parser/GenParser.h	Wed Aug  2 15:54:31 2017	(r2688)
+++ trunk/GME/Parser/GenParser.h	Wed Aug  2 15:54:35 2017	(r2689)
@@ -107,14 +107,18 @@
 
 	template<class INTERFACE, class FUNC_INTERFACE>
 	void Attr(attributes_iterator i, const TCHAR *name, INTERFACE p,
-	HRESULT (__stdcall FUNC_INTERFACE::*func)(long))
+		HRESULT (__stdcall FUNC_INTERFACE::*func)(long))
 	{
 		if( i->first == name )
 		{
 			FUNC_INTERFACE *q = p;
 			ASSERT( q != NULL );
 
-			COMTHROW( (q->*func)(toLong(i->second)) );
+			HRESULT hr = (q->*func)(toLong(i->second));
+			if (FAILED(hr))
+			{
+				throw_last_com_error(hr);
+			}
 		}
 	}
 


More information about the gme-commit mailing list