From ea7187b30d2f05d2196ba6c042c3d045df3bb460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Tue, 14 Feb 2017 15:57:37 +0100 Subject: [PATCH] Capture any error processing authorization on github and convert it to a Http400 --- taiga/importers/github/importer.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/taiga/importers/github/importer.py b/taiga/importers/github/importer.py index b042feef..daee40c8 100644 --- a/taiga/importers/github/importer.py +++ b/taiga/importers/github/importer.py @@ -19,6 +19,8 @@ from taiga.timeline.rebuilder import rebuild_timeline from taiga.timeline.models import Timeline from taiga.users.models import User, AuthData +from taiga.importers.exceptions import InvalidAuthResult + class GithubClient: def __init__(self, token): @@ -530,7 +532,10 @@ class GithubImporter: if result.status_code > 299: raise InvalidAuthResult() else: - return dict(parse_qsl(result.content))[b'access_token'].decode('utf-8') + try: + return dict(parse_qsl(result.content))[b'access_token'].decode('utf-8') + except: + raise InvalidAuthResult() class AssignedEventHandler: