blob: f9bfceec5a316b9303a12ff693cedcfeb75d7e1c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
From: Neil Muller <drnlmuller+debian@gmail.com>
Date: Sun, 13 May 2018 15:09:55 +0200
Subject: Only HTTPError has a code attribute
This would cause irker to crash in case we get a URLError instead of HTTPError,
for example.
Patch-Name: 0010-fix_ioerror_exception.patch
Forwarded: https://gitlab.com/esr/irker/merge_requests/14
---
irkerhook.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/irkerhook.py b/irkerhook.py
index 8bf46f8..d32b742 100755
--- a/irkerhook.py
+++ b/irkerhook.py
@@ -95,12 +95,14 @@ class Commit:
self.url = webview
else:
self.url = webview
- except IOError as e:
+ except urllib2.HTTPError as e:
if e.code == 401:
# Authentication error, so we assume the view is valid
self.url = webview
else:
self.url = ""
+ except IOError:
+ self.url = ""
res = self.template % self.__dict__
return unicode(res, 'UTF-8') if not isinstance(res, unicode) else res
|