Skip to content

Commit

Permalink
[FIX] hw_drivers: Try catch the load of iot handlers
Browse files Browse the repository at this point in the history
Currently, if a problem occurs during the loading of iot handlers
(drivers or interfaces), all loading of iot handlers is compromised.

With this FIX we display the Exception and the file concerned without
blocking the operation of the iot

closes odoo#118557

X-original-commit: 3b717b0
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
  • Loading branch information
qle-odoo committed Apr 14, 2023
1 parent 9dc4b2b commit 2badc30
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion addons/hw_drivers/tools/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,11 @@ def load_iot_handlers():
spec = util.spec_from_file_location(file, str(Path(path).joinpath(file)))
if spec:
module = util.module_from_spec(spec)
spec.loader.exec_module(module)
try:
spec.loader.exec_module(module)
except Exception as e:
_logger.error('Unable to load file: %s ', file)
_logger.error('An error encountered : %s ', e)
lazy_property.reset_all(http.root)

def list_file_by_os(file_list):
Expand Down

0 comments on commit 2badc30

Please sign in to comment.