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

fix(device): only log class name when logging errors

Instead of outputting "class <AttributeError>", it will be better
to just output "AttributeError" to the log.

Issue #2289
Jason Rumney 7 месяцев назад
Родитель
Сommit
c7140a47f4
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      custom_components/tuya_local/device.py

+ 3 - 3
custom_components/tuya_local/device.py

@@ -97,7 +97,7 @@ class TuyaLocalDevice(object):
         except Exception as e:
             _LOGGER.error(
                 "%s: %s while initialising device %s",
-                type(e),
+                type(e).__name__,
                 e,
                 dev_id,
             )
@@ -373,7 +373,7 @@ class TuyaLocalDevice(object):
                 _LOGGER.exception(
                     "%s receive loop error %s:%s",
                     self.name,
-                    type(t),
+                    type(t).__name__,
                     t,
                 )
                 self._api.set_socketPersistent(False)
@@ -610,7 +610,7 @@ class TuyaLocalDevice(object):
             except Exception as e:
                 _LOGGER.debug(
                     "Retrying after exception %s %s (%d/%d)",
-                    type(e),
+                    type(e).__name__,
                     e,
                     i,
                     connections,