[commit] r1880 - in trunk: GME/Parser Tests/GPyUnit

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Fri Mar 23 16:41:14 CDT 2012


Author: ksmyth
Date: Fri Mar 23 16:41:13 2012
New Revision: 1880

Log:
GME-381: better error messages from Parser.ParseProject

Modified:
   trunk/GME/Parser/GenParser.cpp
   trunk/Tests/GPyUnit/test_parser.py

Modified: trunk/GME/Parser/GenParser.cpp
==============================================================================
--- trunk/GME/Parser/GenParser.cpp	Fri Mar 23 16:40:51 2012	(r1879)
+++ trunk/GME/Parser/GenParser.cpp	Fri Mar 23 16:41:13 2012	(r1880)
@@ -41,10 +41,17 @@
 
 void CGenParser::SetErrorInfo2(HRESULT hr)
 {
+	_bstr_t bstr;
+	GetErrorInfo(hr, bstr.GetAddress());
 	std::tstring str;
 	Format(str, _T("in file %s at line %ld, char %ld"), 
 		xmlfile.c_str(), err_line, err_column);
 
+	if (bstr.length())
+	{
+		str = std::tstring(static_cast<const TCHAR*>(bstr)) + _T(": ") + str;
+	}
+
 	SetErrorInfo(hr, _bstr_t(str.c_str()));
 }
 

Modified: trunk/Tests/GPyUnit/test_parser.py
==============================================================================
--- trunk/Tests/GPyUnit/test_parser.py	Fri Mar 23 16:40:51 2012	(r1879)
+++ trunk/Tests/GPyUnit/test_parser.py	Fri Mar 23 16:41:13 2012	(r1880)
@@ -14,6 +14,16 @@
         if type(self) == TestParser:
             self.assertTrue(os.path.isfile(_adjacent_file("parsertest.mga")))
     
+    def test_ParseInTx(self):
+        project = GPyUnit.util.DispatchEx("Mga.MgaProject")
+        project.Create(self.connstr, "MetaGME")
+        project.BeginTransactionInNewTerr()
+        try:
+            mga = GPyUnit.util.parse_xme(self.connstr, project=project)
+        except Exception, e:
+            self.assertTrue(str(e).find("already in transaction") != -1)
+        project.Close(True)
+    
     @property
     def connstr(self):
         return "MGA=" + _adjacent_file("parsertest.mga")


More information about the gme-commit mailing list