improve errorhandling in get_ntp
This commit is contained in:
@@ -6,5 +6,8 @@ c = ntplib.NTPClient()
|
||||
try:
|
||||
response = c.request(sys.argv[1])
|
||||
print(ctime(response.tx_time))
|
||||
except:
|
||||
print("ERROR")
|
||||
except ntplib.NTPException as e:
|
||||
print(f"ERROR during NTP request: {e}")
|
||||
print("Usage: ntp-client.py <hostname>")
|
||||
sys.exit(-1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user