mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
provide more info in sync error messages; catch zlib decode errors
This commit is contained in:
parent
2013e7e4ff
commit
a383223e02
1 changed files with 8 additions and 3 deletions
11
anki/sync.py
11
anki/sync.py
|
@ -1143,12 +1143,17 @@ class HttpSyncServerProxy(SyncServer):
|
||||||
try:
|
try:
|
||||||
f = urllib2.urlopen(SYNC_URL + action, data)
|
f = urllib2.urlopen(SYNC_URL + action, data)
|
||||||
except (urllib2.URLError, socket.error, socket.timeout,
|
except (urllib2.URLError, socket.error, socket.timeout,
|
||||||
httplib.BadStatusLine):
|
httplib.BadStatusLine), e:
|
||||||
raise SyncError(type="noResponse")
|
raise SyncError(type="connectionError",
|
||||||
|
exc=`e`)
|
||||||
ret = f.read()
|
ret = f.read()
|
||||||
if not ret:
|
if not ret:
|
||||||
raise SyncError(type="noResponse")
|
raise SyncError(type="noResponse")
|
||||||
return self.unstuff(ret)
|
try:
|
||||||
|
return self.unstuff(ret)
|
||||||
|
except Exception, e:
|
||||||
|
raise SyncError(type="connectionError",
|
||||||
|
exc=`e`)
|
||||||
|
|
||||||
# HTTP server: respond to proxy requests and return data
|
# HTTP server: respond to proxy requests and return data
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
Loading…
Reference in a new issue