소스 검색

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 달 전
부모
커밋
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:
         except Exception as e:
             _LOGGER.error(
             _LOGGER.error(
                 "%s: %s while initialising device %s",
                 "%s: %s while initialising device %s",
-                type(e),
+                type(e).__name__,
                 e,
                 e,
                 dev_id,
                 dev_id,
             )
             )
@@ -373,7 +373,7 @@ class TuyaLocalDevice(object):
                 _LOGGER.exception(
                 _LOGGER.exception(
                     "%s receive loop error %s:%s",
                     "%s receive loop error %s:%s",
                     self.name,
                     self.name,
-                    type(t),
+                    type(t).__name__,
                     t,
                     t,
                 )
                 )
                 self._api.set_socketPersistent(False)
                 self._api.set_socketPersistent(False)
@@ -610,7 +610,7 @@ class TuyaLocalDevice(object):
             except Exception as e:
             except Exception as e:
                 _LOGGER.debug(
                 _LOGGER.debug(
                     "Retrying after exception %s %s (%d/%d)",
                     "Retrying after exception %s %s (%d/%d)",
-                    type(e),
+                    type(e).__name__,
                     e,
                     e,
                     i,
                     i,
                     connections,
                     connections,