Преглед изворни кода

switch: use specific exception to catch and log warnings

Jason Rumney пре 2 година
родитељ
комит
12e33d812f
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      custom_components/tuya_local/switch.py

+ 1 - 1
custom_components/tuya_local/switch.py

@@ -45,7 +45,7 @@ class TuyaLocalSwitch(TuyaLocalEntity, SwitchEntity):
         dclass = self._config.device_class
         dclass = self._config.device_class
         try:
         try:
             return SwitchDeviceClass(dclass)
             return SwitchDeviceClass(dclass)
-        except:
+        except ValueError:
             if dclass:
             if dclass:
                 _LOGGER.warning(
                 _LOGGER.warning(
                     "%s/%s: Unrecognised switch device class of %s ignored",
                     "%s/%s: Unrecognised switch device class of %s ignored",