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

Backported from master.
  • Loading branch information
dgw committed Aug 4, 2021
1 parent 445b304 commit ae9e6a4
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 @@ -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:
Expand Down Expand Up @@ -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,
})

Expand Down

0 comments on commit ae9e6a4

Please sign in to comment.