commit:     f21b0d05feb942e814a94190b63e0b918f622bab
Author:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
AuthorDate: Sat May 29 08:29:56 2021 +0000
Commit:     Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
CommitDate: Sat May 29 08:33:22 2021 +0000
URL:        https://gitweb.gentoo.org/proj/tatt.git/commit/?id=f21b0d05

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 <module>
      response = response["bugs"][0]
  IndexError: list index out of range

Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>

 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:

Reply via email to