summaryrefslogtreecommitdiff
path: root/grc/core
diff options
context:
space:
mode:
authorGrant Cox <grant.cox@deepspaceamps.com>2019-12-18 08:59:53 -0600
committerMarcus Müller <marcus@hostalia.de>2019-12-19 18:50:58 +0100
commitc24b15b48dbf0487ae8f8d4fc1c2570a23b6b28c (patch)
tree49d695c6bdb922c13480cadb20f4094f7f98e17e /grc/core
parent3918935810ffdede5bc564ee0854f9cc6293289f (diff)
grc: add send_flowgraph_error_report to Messages
add method to the Messages module to print flowgraph errors in a verbose format
Diffstat (limited to 'grc/core')
-rw-r--r--grc/core/Messages.py14
-rw-r--r--grc/core/platform.py15
2 files changed, 15 insertions, 14 deletions
diff --git a/grc/core/Messages.py b/grc/core/Messages.py
index 6d67dc7d2e..df7084996d 100644
--- a/grc/core/Messages.py
+++ b/grc/core/Messages.py
@@ -143,3 +143,17 @@ def send_fail_save_preferences(prefs_file_path):
def send_warning(warning):
send('>>> Warning: %s\n' % warning)
+
+
+def send_flowgraph_error_report(flowgraph):
+ """ verbose error report for flowgraphs """
+ error_list = flowgraph.get_error_messages()
+ if not error_list:
+ return
+
+ send('*' * 50 + '\n')
+ summary_msg = '{} errors from flowgraph:\n'.format(len(error_list))
+ send(summary_msg)
+ for err in error_list:
+ send(err)
+ send('\n' + '*' * 50 + '\n')
diff --git a/grc/core/platform.py b/grc/core/platform.py
index e62ebebef2..d84500b4f8 100644
--- a/grc/core/platform.py
+++ b/grc/core/platform.py
@@ -110,7 +110,7 @@ class Platform(Element):
raise Exception('Not a hier block')
except Exception as e:
Messages.send('>>> Load Error: {}: {}\n'.format(file_path, str(e)))
- self._flowgraph_error_report(flow_graph)
+ Messages.send_flowgraph_error_report(flow_graph)
return None, None
finally:
self._auto_hier_block_generate_chain.discard(file_path)
@@ -393,19 +393,6 @@ class Platform(Element):
return [(value, name, value == output_language_default)
for value, name in zip(param['options'], param['option_labels'])]
- def _flowgraph_error_report(self, flowgraph):
- """ verbose error report upon loading exception """
- error_list = flowgraph.get_error_messages()
- if not error_list:
- return
-
- Messages.send('*' * 50 + '\n')
- summary_msg = '{} errors from flowgraph:\n'.format(len(error_list))
- Messages.send(summary_msg)
- for err in error_list:
- Messages.send(err)
- Messages.send('\n' + '*' * 50 + '\n')
-
##############################################
# Factories
##############################################