From f21b0d05feb942e814a94190b63e0b918f622bab Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sat, 29 May 2021 10:29:56 +0200 Subject: output a proper error message if the bug does not exist Otherwise one would see the following misleading message: File "/usr/lib/python-exec/python3.8/tatt", line 155, in response = response["bugs"][0] IndexError: list index out of range Signed-off-by: Rolf Eike Beer --- scripts/tatt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/tatt b/scripts/tatt index 7524c8b..7d0f378 100755 --- a/scripts/tatt +++ b/scripts/tatt @@ -152,6 +152,10 @@ if options.bugnum: if "message" in response: print(response["message"]) sys.exit(1) + if len(response["bugs"]) == 0: + print("bug " + options.bugnum + " not found in bugzilla") + sys.exit(1) + response = response["bugs"][0] if "KEYWORDREQ" in response["keywords"] or response["component"] == "Keywording": # This is a keywording bug: -- cgit v1.2.3-65-gdbad