From c3dbed31d28cb0a0aaf44c8615a8d58b2cd05883 Mon Sep 17 00:00:00 2001
From: "Yaroslav Soroko (yaso)" <yaso@odoo.com>
Date: Thu, 31 Aug 2023 15:50:38 +0200
Subject: [PATCH] [FIX] hw_drivers: Error-proof Interfaces

Before, when instatating the interfaces if there was an error inside
Odoo could stop. This PR prevents that and simply avoids instantiating
the interface which causes the error.

closes odoo/odoo#133872

X-original-commit: e8f700f766bde6906076192ffe12eec255454a81
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
---
 addons/hw_drivers/main.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/addons/hw_drivers/main.py b/addons/hw_drivers/main.py
index ab5e4ffc28d0..5995d3e0360c 100644
--- a/addons/hw_drivers/main.py
+++ b/addons/hw_drivers/main.py
@@ -93,9 +93,12 @@ class Manager(Thread):
 
         # Start the interfaces
         for interface in interfaces.values():
-            i = interface()
-            i.daemon = True
-            i.start()
+            try:
+                i = interface()
+                i.daemon = True
+                i.start()
+            except Exception as e:
+                _logger.error("Error in %s: %s", str(interface), e)
 
         # Check every 3 secondes if the list of connected devices has changed and send the updated
         # list to the connected DB.
-- 
GitLab