Salome HOME
Suppress stack printing for SAT exceptions (unless debug mode is active)
authorcrouzet <nicolas.crouzet@cea.fr>
Fri, 29 Nov 2019 10:12:09 +0000 (11:12 +0100)
committercrouzet <nicolas.crouzet@cea.fr>
Fri, 29 Nov 2019 10:12:09 +0000 (11:12 +0100)
  and also remplace assert by sat exception in compile.py
           suppress a confusing warning message in sat
           message translation modification

commands/compile.py
sat
src/i18n/fr/LC_MESSAGES/salomeTools.po
src/salomeTools.py

index 8010b33125d449e99f88f351b2fa6156d8776b57..e0a1f99b5d786e24cff4916e47653333b5ec628c 100644 (file)
@@ -93,11 +93,14 @@ def find_path_graph(graph, start, end, path=[]):
 # return in sorted_nodes the list of sorted nodes
 def depth_first_topo_graph(graph, start, visited=[], sorted_nodes=[]):
     visited = visited + [start]
+    if start not in graph:
+        raise src.SatException('Error in product dependencies : %s product is referenced in products dependencies but is not present in the application !' % start)
     for node in graph[start]:
         if node not in visited:
             visited,sorted_nodes=depth_first_topo_graph(graph, node, visited,sorted_nodes)
         else:
-            assert node in sorted_nodes, 'Error : cycle detection for node %s and %s !' % (start,node)
+            if node not in sorted_nodes:
+                raise src.SatException('Error in product dependencies : cycle detection for node %s and %s !' % (start,node))
     
     sorted_nodes = sorted_nodes + [start]
     return visited,sorted_nodes
diff --git a/sat b/sat
index b162b7abf3fba1a18838825751386e67bd0a78d9..04bdd16d4bf8983f9a2c11e1485e5d5e86ca146a 100755 (executable)
--- a/sat
+++ b/sat
@@ -68,12 +68,7 @@ if __name__ == "__main__":
 
     # no Exception but may be known problem
     DBG.write("execute_cli return code", returnCode)
-    if returnCode.isOk():
-      # OK no trace
-      logger.step("sat exit code: %s" % returnCode)
-    else:
-      # KO warning as known problem have to say why
-      logger.warning("sat exit code: %s" % returnCode)
+    logger.step("sat exit code: %s" % returnCode)
     logger.close() # important to close logger
     sys.exit(returnCode.toSys())
 
index 0fea97d5b8523849e690297895792e2a0f361a6e..758dc1162aa6ab19cb1089dea547d33306e8b1f6 100644 (file)
@@ -1846,7 +1846,7 @@ msgid "shows global help or help on a specific command."
 msgstr "affiche l'aide générale ou pour une commande spécifique."
 
 msgid "overwrites a configuration parameters."
-msgstr "écrase un parametre de configuration."
+msgstr "modifie un parametre de configuration."
 
 msgid "run salomeTools in debug mode."
 msgstr "lance salomeTools en mode debug."
index 9c5da619dc8f31e2c089220d5097cd756592c7b1..a49524b24c465199efc051015dc06bed564dd2f7 100755 (executable)
@@ -480,8 +480,18 @@ class Sat(object):
                     if res is None:
                         res = 0
                         
+                except src.SatException as e:
+                    # for sat exception do not display the stack, unless debug mode is set
+                    logger_command.write("\n***** ", 1)
+                    logger_command.write(src.printcolors.printcError(
+                            "salomeTools ERROR: sat %s" % __nameCmd__), 1)
+                    logger_command.write(" *****\n", 1)
+                    print(e.message)
+                    if self.options.debug_mode:
+                        logger_command.write("\n" + DBG.format_exception("") + "\n", 1)
+
                 except Exception as e:
-                    # Get error
+                    # here we print the stack in addition
                     logger_command.write("\n***** ", 1)
                     logger_command.write(src.printcolors.printcError(
                             "salomeTools ERROR: sat %s" % __nameCmd__), 1)