Kaynağa Gözat

switch: use specific exception to catch and log warnings

Jason Rumney 2 yıl önce
ebeveyn
işleme
12e33d812f
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  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",