From c84052cb66e0e6f13aedf17f82de790d8a7d84e0 Mon Sep 17 00:00:00 2001
From: Yusei Tahara <yusei@nexedi.com>
Date: Tue, 29 Jan 2008 15:52:45 +0000
Subject: [PATCH] Output error_log message when tic fails.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18907 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/tests/ERP5TypeTestCase.py | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/product/ERP5Type/tests/ERP5TypeTestCase.py b/product/ERP5Type/tests/ERP5TypeTestCase.py
index 38ee4b3576..726c73069c 100644
--- a/product/ERP5Type/tests/ERP5TypeTestCase.py
+++ b/product/ERP5Type/tests/ERP5TypeTestCase.py
@@ -498,10 +498,21 @@ class ERP5TypeTestCase(PortalTestCase):
           # This prevents an infinite loop.
           count -= 1
           if count == 0:
+            # Get the last error message from error_log.
+            error_message = ''
+            error_log = self.getPortal().error_log._getLog()
+            if len(error_log):
+              error_message = '\nLast error message:\n%s\n%s\n%s\n' % (
+                error_log[0]['type'],
+                error_log[0]['value'],
+                error_log[0]['tb_text'],
+                )
             raise RuntimeError,\
-              'tic is looping forever. These messages are pending: %r' % (
+              'tic is looping forever. These messages are pending: %r %s' % (
             [('/'.join(m.object_path), m.method_id, m.processing_node, m.priority)
-            for m in portal_activities.getMessageList()],)
+            for m in portal_activities.getMessageList()],
+            error_message
+            )
           # This give some time between messages
           if count % 10 == 0:
             from Products.CMFActivity.Activity.Queue import VALIDATION_ERROR_DELAY
-- 
2.30.9