Package: irker / 2.18+dfsg-2

0010-fix_ioerror_exception.patch Patch series | download
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
From 7zb5019b8bdba49e24ca1cbc8b81f665e19f50ce1 Mon Sep 12 17:39:15 2016
From Laurent Bachelier <laurent@bachelier.name>
Date: Tue, 1 Nov 13:22:18 2016 +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

diff --git a/irkerhook.py b/irkerhook.py
index 9768eac..ce19446 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