[commit] r1413 - trunk/GME/Parser

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Tue Jul 19 13:40:10 CDT 2011


Author: ksmyth
Date: Tue Jul 19 13:40:10 2011
New Revision: 1413

Log:
Try to warn user about circular refs in xmes

Modified:
   trunk/GME/Parser/MgaParser.cpp
   trunk/GME/Parser/MgaParser.h

Modified: trunk/GME/Parser/MgaParser.cpp
==============================================================================
--- trunk/GME/Parser/MgaParser.cpp	Tue Jul 19 13:37:28 2011	(r1412)
+++ trunk/GME/Parser/MgaParser.cpp	Tue Jul 19 13:40:10 2011	(r1413)
@@ -448,7 +448,7 @@
 		{
 			CGenParser::startElement(name, attributes);
 		}
-		catch(pass_exception &)
+		catch(pass_exception &e)
 		{
 			ASSERT( skip_element_level == 0 );
 
@@ -457,6 +457,9 @@
 			elements.pop_back();
 			ranges.back().previous = elements.back();
 			skip_element_level = 1;
+			if (pass_count == 99)
+				if (m_GME)
+					m_GME->ConsoleMessage(_bstr_t(e.wwhat()), msgtype_enum::MSG_ERROR);
 		}
 	}
 }
@@ -952,7 +955,7 @@
 				LookupByID(GetCurrData(), object);
 
 				if( object == NULL )
-					throw pass_exception();
+					throw pass_exception(std::wstring(L"Referenced FCO ") + GetCurrData() + L" not found");
 
 				CopyTo(object, v);
 			}
@@ -1074,7 +1077,7 @@
 
 	LookupByID(*s, deriv.from);
 	if( deriv.from == NULL )
-		throw pass_exception();
+		throw pass_exception(std::wstring(L"Subtype/instance ") + *GetByNameX(attributes, _T("id")) + L" cannot find archetype " + *s);
 
 	s = GetByNameX(attributes, _T("isinstance"));
 	deriv.isinstance = ( s != NULL && *s == _T("yes") ) ? VARIANT_TRUE : VARIANT_FALSE;
@@ -1394,7 +1397,7 @@
 	CComObjPtr<IMgaFCO> target;
 	LookupByID(GetByName(attributes, _T("target")), target);
 	if( target == NULL )
-		throw pass_exception();
+		throw pass_exception(std::wstring(L"Connection end ") + GetByName(attributes, _T("target")) + L" not found");
 
 
 	CComObjPtr<IMgaFCOs> coll;
@@ -1504,7 +1507,7 @@
 		LookupByID(*s, referred);
 
 		if( referred == NULL )
-			throw pass_exception();
+			throw pass_exception(std::wstring(L"Referenced FCO ") + GetCurrData() + L" not found");
 	}
 
 	if( GetPrevName() == _T("folder") )
@@ -1605,7 +1608,7 @@
 			LookupByID(std::tstring(*s, pos, pos2-pos), member);
 
 			if( member == NULL )
-				throw pass_exception();
+				throw pass_exception(std::wstring(L"Set member ") + std::tstring(*s, pos, pos2-pos) + L" not found");
 
 			members.push_front(member);
 

Modified: trunk/GME/Parser/MgaParser.h
==============================================================================
--- trunk/GME/Parser/MgaParser.h	Tue Jul 19 13:37:28 2011	(r1412)
+++ trunk/GME/Parser/MgaParser.h	Tue Jul 19 13:40:10 2011	(r1413)
@@ -88,6 +88,16 @@
 	int skip_element_level;
 	class pass_exception : public std::exception
 	{
+		std::wstring w;
+	public:
+		pass_exception() { }
+		pass_exception(std::wstring what) : w(what) { }
+		virtual const char *what() const {
+			return static_cast<const char*>(_bstr_t(w.c_str()));
+		}
+		virtual const wchar_t *wwhat() const {
+			return w.c_str();
+		}
 	};
 
 	typedef struct librecord {


More information about the gme-commit mailing list