mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-28 19:50:06 +02:00
catching socket.timeout using tuple exception #8
This commit is contained in:
parent
b20d140383
commit
0f7ad23e3c
2 changed files with 15 additions and 2 deletions
|
@ -172,6 +172,19 @@ class MikrotikAPI:
|
|||
self.lock.release()
|
||||
return None
|
||||
|
||||
try:
|
||||
tuple(response)
|
||||
except librouteros_custom.exceptions.ConnectionClosed as api_error:
|
||||
_LOGGER.error("Mikrotik %s error while path %s", self._host, api_error)
|
||||
self.disconnect()
|
||||
self.lock.release()
|
||||
return None
|
||||
except:
|
||||
_LOGGER.error("Mikrotik %s error while path %s", self._host, "unknown")
|
||||
self.disconnect()
|
||||
self.lock.release()
|
||||
return None
|
||||
|
||||
self.lock.release()
|
||||
return response if response else None
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue