From 4a4ae0e95c40e24f30944db684aa719370e4848f Mon Sep 17 00:00:00 2001 From: tke Date: Mon, 6 May 2024 07:47:47 +0200 Subject: [PATCH] improve errorhandling in get_ntp --- tools/get_ntp.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/get_ntp.py b/tools/get_ntp.py index a362400..df37ace 100755 --- a/tools/get_ntp.py +++ b/tools/get_ntp.py @@ -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 ") + sys.exit(-1) +