From ae9e6a4dcc5a75bc80d5eacb570b05d80f96bc76 Mon Sep 17 00:00:00 2001 From: dgw Date: Tue, 3 Aug 2021 13:01:34 -0600 Subject: [PATCH] Merge pull request #2135 from Exirel/cli-plugins-list-show-error-info cli.plugins: keep plugin meta info on loading error Backported from master. --- sopel/cli/plugins.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/sopel/cli/plugins.py b/sopel/cli/plugins.py index 8cd34f6250..6728680a40 100644 --- a/sopel/cli/plugins.py +++ b/sopel/cli/plugins.py @@ -212,12 +212,15 @@ def handle_list(options): else: description['name'] = utils.red(name) except Exception as error: - label = ('%s' % error) or 'unknown loading exception' + description.update(plugin.get_meta_description()) + + meta_label = description.get('label') or '(error)' + error_label = ('%s' % error) or 'unknown loading exception' + label = '%s (error: %s)' % (meta_label, error_label) error_status = 'error' + description.update({ - 'label': 'Error: %s' % label, - 'type': 'unknown', - 'source': 'unknown', + 'label': label, 'status': error_status, }) if not no_color: @@ -268,12 +271,15 @@ def handle_show(options): description.update(plugin.get_meta_description()) loaded = True except Exception as error: - label = ('%s' % error) or 'unknown loading exception' + description.update(plugin.get_meta_description()) + + meta_label = description.get('label') or '(error)' + error_label = ('%s' % error) or 'unknown loading exception' + label = '%s (error: %s)' % (meta_label, error_label) error_status = 'error' + description.update({ - 'label': 'Error: %s' % label, - 'type': 'unknown', - 'source': 'unknown', + 'label': label, 'status': error_status, })