Просмотр исходного кода

Catch parse exceptions in config files when matching.

Rather than a generic exception stack trace, it is better to get a message
saying where the problem is.
Jason Rumney 2 лет назад
Родитель
Сommit
85ea9224f5
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      custom_components/tuya_local/helpers/device_config.py

+ 5 - 2
custom_components/tuya_local/helpers/device_config.py

@@ -864,8 +864,11 @@ def possible_matches(dps):
     """Return possible matching configs for a given set of dps values."""
     for cfg in available_configs():
         parsed = TuyaDeviceConfig(cfg)
-        if parsed.matches(dps):
-            yield parsed
+        try:
+            if parsed.matches(dps):
+                yield parsed
+        except TypeError:
+            _LOGGER.error("Parse error in %s", cfg)
 
 
 def get_config(conf_type):