]> git.phdru.name Git - bookmarks_db.git/commitdiff
Fix(bkmk_rrequests): Not all error codes have messages
authorOleg Broytman <phd@phdru.name>
Thu, 8 Aug 2024 17:52:48 +0000 (20:52 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 15 Aug 2024 17:45:00 +0000 (20:45 +0300)
Robots/bkmk_rrequests.py

index 638ed9129d07f3c92e2e7c7f026e4e12c1a995fc..ebe90cbda2cd12c80214a505c3e34a3f254ddc66 100644 (file)
@@ -52,7 +52,10 @@ class robot_requests(robot_base):
             error = str(e)
         else:
             if r.status_code >= 400:
-                error = requests.status_codes._codes[r.status_code][0]
+                try:
+                    error = requests.status_codes._codes[r.status_code][0]
+                except KeyError:
+                    error = "Error"
                 error = '%d %s' % (r.status_code, error)
 
         if error is not None: