From: Oleg Broytman Date: Thu, 8 Aug 2024 17:52:48 +0000 (+0300) Subject: Fix(bkmk_rrequests): Not all error codes have messages X-Git-Tag: 5.6.1~3 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=2e1b0a31a146cd809797ebc3f7bcfa543e530f94;p=bookmarks_db.git Fix(bkmk_rrequests): Not all error codes have messages --- diff --git a/Robots/bkmk_rrequests.py b/Robots/bkmk_rrequests.py index 638ed91..ebe90cb 100644 --- a/Robots/bkmk_rrequests.py +++ b/Robots/bkmk_rrequests.py @@ -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: