瀏覽代碼

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 3 年之前
父節點
當前提交
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):