diff options
author | Ryan Volz <ryan.volz@gmail.com> | 2021-04-05 15:32:33 -0400 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2021-06-01 07:23:36 -0400 |
commit | 6a8fc29d0a6244a1c4624500e853fb23d17ceb86 (patch) | |
tree | be5eb5457f84c020de7652997d9cda2c9f874fb7 /grc/core/platform.py | |
parent | ac9eb756cc1d9dd414dbd166a99f1488f14385f2 (diff) |
grc: Be more informative when missing "options" block.
This raises an RuntimeError describing that GRC could not find the
built-in blocks rather than raising a KeyError on "options", which
left users with little to go on. This error has come up in various
situations involving an incorrect blocks path (due to mixing GR
versions causing the configuration files to point to the wrong
installation) or simply the blocks not being installed.
Signed-off-by: Ryan Volz <ryan.volz@gmail.com>
Diffstat (limited to 'grc/core/platform.py')
-rw-r--r-- | grc/core/platform.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/grc/core/platform.py b/grc/core/platform.py index 8ba473a2cc..02cb385e57 100644 --- a/grc/core/platform.py +++ b/grc/core/platform.py @@ -179,7 +179,20 @@ class Platform(Element): self._docstring_extractor.finish() # self._docstring_extractor.wait() - utils.hide_bokeh_gui_options_if_not_installed(self.blocks['options']) + if 'options' not in self.blocks: + # we didn't find one of the built-in blocks ("options") + # which probably means the GRC blocks path is bad + errstr = ( + "Failed to find built-in GRC blocks (specifically, the " + "'options' block). Ensure your GRC block paths are correct " + "and at least one points to your prefix installation:" + ) + errstr = "\n".join([errstr] + (path or self.config.block_paths)) + raise RuntimeError(errstr) + else: + # might have some cleanup to do on the options block in particular + utils.hide_bokeh_gui_options_if_not_installed(self.blocks['options']) + def _iter_files_in_block_path(self, path=None, ext='yml'): """Iterator for block descriptions and category trees""" |