fix: print stack trace on connection reset

This commit is contained in:
Luke Bonaccorsi 2024-03-04 01:07:44 +00:00
parent 3dd4a7b0e0
commit 2c741fe32e
1 changed files with 2 additions and 1 deletions

View File

@ -46,6 +46,7 @@ import socket
import struct import struct
import sys import sys
import time import time
import traceback
from typing import Callable, Coroutine from typing import Callable, Coroutine
from cryptography.hazmat.backends.openssl import backend as openssl_backend from cryptography.hazmat.backends.openssl import backend as openssl_backend
@ -835,7 +836,7 @@ class TuyaDevice:
self._LOGGER.debug("Incomplete read") self._LOGGER.debug("Incomplete read")
elif isinstance(e, ConnectionResetError): elif isinstance(e, ConnectionResetError):
self._LOGGER.debug( self._LOGGER.debug(
"Connection reset: {}\n{}".format(e, e.__traceback__) "Connection reset: {}\n{}".format(e, traceback.format_exc())
) )
await self.async_disconnect() await self.async_disconnect()