Browse Source

HPCC-24188 Catch errors in statistics definitions sooner

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 5 years ago
parent
commit
b4e0ce55fb
2 changed files with 12 additions and 2 deletions
  1. 11 1
      system/jlib/jlib.cpp
  2. 1 1
      system/jlib/jstats.cpp

+ 11 - 1
system/jlib/jlib.cpp

@@ -47,7 +47,17 @@ void ExitModuleObjects() { ExitModuleObjects(0); }
 
 void _InitModuleObjects()
 {
-    queryInitTable()->init(0);
+    try
+    {
+        queryInitTable()->init(0);
+    }
+    catch(IException * e)
+    {
+        StringBuffer msg;
+        fprintf(stderr, "Exception in initialization code: %s\n", e->errorMessage(msg).str());
+        unsigned code = e->errorCode();
+        _exit(code ? code : 2);
+    }
 }
 
 InitTable::InitTable()

+ 1 - 1
system/jlib/jstats.cpp

@@ -3557,7 +3557,7 @@ void verifyStatisticFunctions()
     }
 }
 
-#if 0
+#ifdef _DEBUG
 MODULE_INIT(INIT_PRIORITY_STANDARD)
 {
     verifyStatisticFunctions();