Jelajahi Sumber

HPCC-8507 Improve some xml read errors

Property tree errors (E.g. ambiguity) were not giving any context
i.e. which logical/physical file or offset.

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
Jake Smith 12 tahun lalu
induk
melakukan
388232134d
1 mengubah file dengan 13 tambahan dan 2 penghapusan
  1. 13 2
      thorlcr/activities/xmlread/thxmlreadslave.cpp

+ 13 - 2
thorlcr/activities/xmlread/thxmlreadslave.cpp

@@ -98,13 +98,15 @@ class CXmlReadSlaveActivity : public CDiskReadSlaveActivityBase, public CThorDat
 
             try
             {
-                while (xmlParser->next()) {
+                while (xmlParser->next())
+                {
                     if (lastMatch)
                     {
                         RtlDynamicRowBuilder row(allocator);
                         size32_t sz = xmlTransformer->transform(row, lastMatch, this);
                         lastMatch.clear();
-                        if (sz) {
+                        if (sz)
+                        {
                             localOffset = 0;
                             ++activity.diskProgress;
                             return row.finalizeRowClear(sz);
@@ -112,6 +114,15 @@ class CXmlReadSlaveActivity : public CDiskReadSlaveActivityBase, public CThorDat
                     }
                 }
             }
+            catch (IPTreeException *e)
+            {
+                StringBuffer context;
+                e->errorMessage(context).newline();
+                context.append("Logical filename = ").append(activity.logicalFilename).newline();
+                context.append("Physical file part = ").append(iFile->queryFilename()).newline();
+                context.append("offset = ").append(localOffset);
+                throw MakeStringException(e->errorCode(), "%s", context.str());
+            }
             catch (IXMLReadException *e)
             {
                 if (XmlRead_syntax != e->errorCode())