Handle connection error during ping

This commit is contained in:
cmdr2 2024-10-11 19:18:35 +05:30
parent 739ad3a964
commit 154b550e0e

View File

@ -1,6 +1,6 @@
import os import os
import requests import requests
from requests.exceptions import ConnectTimeout from requests.exceptions import ConnectTimeout, ConnectionError
from typing import Union, List from typing import Union, List
from threading import local as Context from threading import local as Context
from threading import Thread from threading import Thread
@ -91,7 +91,7 @@ def ping(timeout=1):
print(f"Error getting options: {e}") print(f"Error getting options: {e}")
return True return True
except ConnectTimeout as e: except (ConnectTimeout, ConnectionError) as e:
raise TimeoutError(e) raise TimeoutError(e)