# HG changeset patch # User Edouard Tisserant # Date 1590479900 -7200 # Node ID d15a997859b10d54958204ba499ba70e67475a4f # Parent 769fefae7c81385ad49c4745506428f445004c25 Solve import order problem when POULibrary imports ConfigTreeNode because of UserAddressedException. Now UserAddressedException is declared in POULibrary.py, as a quick and dirty fix, but some independant module should be created for beremiz exceptions in general. diff -r 769fefae7c81 -r d15a997859b1 ConfigTreeNode.py --- a/ConfigTreeNode.py Wed Dec 18 13:31:22 2019 +0100 +++ b/ConfigTreeNode.py Tue May 26 09:58:20 2020 +0200 @@ -678,6 +678,3 @@ raise UserAddressedException(message) -class UserAddressedException(Exception): - pass - diff -r 769fefae7c81 -r d15a997859b1 POULibrary.py --- a/POULibrary.py Wed Dec 18 13:31:22 2019 +0100 +++ b/POULibrary.py Tue May 26 09:58:20 2020 +0200 @@ -26,6 +26,10 @@ from __future__ import absolute_import from weakref import ref +# Exception type for problems that user has to take action in order to fix +class UserAddressedException(Exception): + pass + class POULibrary(object): def __init__(self, CTR, LibName, TypeStack): @@ -59,6 +63,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): diff -r 769fefae7c81 -r d15a997859b1 ProjectController.py --- a/ProjectController.py Wed Dec 18 13:31:22 2019 +0100 +++ b/ProjectController.py Tue May 26 09:58:20 2020 +0200 @@ -63,7 +63,8 @@ import targets from runtime.typemapping import DebugTypesSize, UnpackDebugBuffer from runtime import PlcStatus -from ConfigTreeNode import ConfigTreeNode, XSDSchemaErrorMessage, UserAddressedException +from ConfigTreeNode import ConfigTreeNode, XSDSchemaErrorMessage +from POULibrary import UserAddressedException base_folder = paths.AbsParentDir(__file__)