From 192e8959339919ea29305573369ff40ce1e7eda2 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Wed, 7 Mar 2018 16:11:20 +0100 Subject: [PATCH] hw plugins: catch exceptions for custom enumeration functions. related: #4060 --- lib/plugins.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/plugins.py b/lib/plugins.py index 9f58611f0..12d1c0089 100644 --- 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]