Show more exceptions on stdout, particularly those that are raised by AutoLoad (first item in Main Thread worker)
authorEdouard Tisserant
Tue, 02 Oct 2018 15:56:09 +0200
changeset 2307 c44692b53736
parent 2306 908471b344ba
child 2308 4d7cee25a474
Show more exceptions on stdout, particularly those that are raised by AutoLoad (first item in Main Thread worker)
runtime/Worker.py
runtime/__init__.py
--- a/runtime/Worker.py	Tue Oct 02 15:52:11 2018 +0200
+++ b/runtime/Worker.py	Tue Oct 02 15:56:09 2018 +0200
@@ -8,6 +8,7 @@
 # See COPYING.Runtime file for copyrights details.
 
 from __future__ import absolute_import
+import sys
 import thread
 from threading import Lock, Condition
 
@@ -54,8 +55,13 @@
         """
         self._threadID = thread.get_ident()
         if args or kwargs:
-            job(*args, **kwargs).do()
-            # result is ignored
+            _job = job(*args, **kwargs)
+            _job.do()
+            if _job.success:
+                # result is ignored
+                pass
+            else:
+                raise _job.exc_info[0], _job.exc_info[1], _job.exc_info[2]
         self.mutex.acquire()
         while not self._finish:
             self.todo.wait()
--- a/runtime/__init__.py	Tue Oct 02 15:52:11 2018 +0200
+++ b/runtime/__init__.py	Tue Oct 02 15:56:09 2018 +0200
@@ -23,9 +23,8 @@
         exp = sys.exc_info()
     if _PLCObjectSingleton is not None:
         _PLCObjectSingleton.LogMessage(0, msg + '\n'.join(traceback.format_exception(*exp)))
-    else:
-        print(msg)
-        traceback.print_exception(*exp)
+    print(msg)
+    traceback.print_exception(*exp)
 
 def CreatePLCObjectSingleton(*args):
     global _PLCObjectSingleton