Skip to content

Commit

Permalink
Merge pull request #2135 from Exirel/cli-plugins-list-show-error-info
Browse files Browse the repository at this point in the history
cli.plugins: keep plugin meta info on loading error
  • Loading branch information
dgw authored Aug 3, 2021
2 parents e607f08 + 4df1d0e commit c614ca1
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions sopel/cli/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,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:
Expand Down Expand Up @@ -267,12 +270,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,
})

Expand Down

0 comments on commit c614ca1

Please sign in to comment.