# HG changeset patch
# User Edouard Tisserant
# Date 1589374037 -7200
# Node ID a7b11c9f468e245a78b8f34f4896e6b613f7662a
# Parent  c0ea5015e46f1ec26e300e71a81318373b3f0b96
Added FatalError call to Libraries code gen, so that they can emit messages addressed like config tree nodes do.

diff -r c0ea5015e46f -r a7b11c9f468e ConfigTreeNode.py
--- a/ConfigTreeNode.py	Mon May 11 11:33:00 2020 +0200
+++ b/ConfigTreeNode.py	Wed May 13 14:47:17 2020 +0200
@@ -678,6 +678,7 @@
 
         raise UserAddressedException(message)
 
+# Exception type for problems that user has to take action in order to fix
 class UserAddressedException(Exception):
     pass
 
diff -r c0ea5015e46f -r a7b11c9f468e POULibrary.py
--- a/POULibrary.py	Mon May 11 11:33:00 2020 +0200
+++ b/POULibrary.py	Wed May 13 14:47:17 2020 +0200
@@ -26,6 +26,7 @@
 from __future__ import absolute_import
 from weakref import ref
 
+from ConfigTreeNode import UserAddressedException
 
 class POULibrary(object):
     def __init__(self, CTR, LibName, TypeStack):
@@ -59,6 +60,11 @@
         # Pure python or IEC libs doesn't produce C code
         return ((""), [], False), ""
 
+    def FatalError(self, message):
+        """ Raise an exception that will trigger error message intended to 
+            the user, but without backtrace since it is not a software error """
+
+        raise UserAddressedException(message)
 
 def SimplePOULibraryFactory(path):
     class SimplePOULibrary(POULibrary):