commit 192e8959339919ea29305573369ff40ce1e7eda2
parent b02252d664128b117fc6d6608f8f11b94fb329bb
Author: SomberNight <somber.night@protonmail.com>
Date: Wed, 7 Mar 2018 16:11:20 +0100
hw plugins: catch exceptions for custom enumeration functions.
related: #4060
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/plugins.py b/lib/plugins.py
@@ -533,7 +533,13 @@ class DeviceMgr(ThreadJob, PrintError):
# Let plugin handlers enumerate devices we don't know about
for f in self.enumerate_func:
- devices.extend(f())
+ try:
+ new_devices = f()
+ except BaseException as e:
+ self.print_error('custom device enum failed. func {}, error {}'
+ .format(str(f), str(e)))
+ else:
+ devices.extend(new_devices)
# Now find out what was disconnected
pairs = [(dev.path, dev.id_) for dev in devices]