XOAUTH2: improve error message while trying to get access token

Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/338
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2016-08-15 02:07:14 +02:00
parent 1884fd7ef6
commit 71d86b6d47

View File

@ -253,6 +253,12 @@ class IMAPServer(object):
try: try:
response = urllib.urlopen( response = urllib.urlopen(
self.oauth2_request_url, urllib.urlencode(params)).read() self.oauth2_request_url, urllib.urlencode(params)).read()
except Exception as e:
try:
msg = "%s (configuration is: %s)"% (e, str(params))
except Exception as eparams:
msg = "%s [cannot display configuration: %s]"% (e, eparams)
six.reraise(type(e), type(e)(msg), exc_info()[2])
finally: finally:
socket.socket = original_socket socket.socket = original_socket