Better error message when disabling unknown plugin

This commit is contained in:
Kovid Goyal 2024-10-11 08:43:33 +05:30
parent 781c73ff5f
commit 9cb1c50887
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -83,6 +83,8 @@ def load_plugin(path_to_zip_file): # {{{
def disable_plugin(plugin_or_name):
x = getattr(plugin_or_name, 'name', plugin_or_name)
plugin = find_plugin(x)
if plugin is None:
raise ValueError(f'No plugin named: {x} found')
if not plugin.can_be_disabled:
raise ValueError('Plugin %s cannot be disabled'%x)
dp = config['disabled_plugins']