don't pop up network errors for media sync

log them instead
This commit is contained in:
Damien Elmes 2020-03-23 19:06:13 +10:00
parent f429986246
commit f889616ef1

View file

@ -11,7 +11,8 @@ from typing import List, Union
import aqt import aqt
from anki import hooks from anki import hooks
from anki.consts import SYNC_BASE from anki.consts import SYNC_BASE
from anki.rsbackend import TR, Interrupted, MediaSyncProgress, Progress, ProgressKind from anki.rsbackend import TR, Interrupted, MediaSyncProgress, Progress, \
ProgressKind, NetworkError
from anki.types import assert_impossible from anki.types import assert_impossible
from anki.utils import intTime from anki.utils import intTime
from aqt import gui_hooks from aqt import gui_hooks
@ -100,6 +101,10 @@ class MediaSyncer:
if isinstance(exc, Interrupted): if isinstance(exc, Interrupted):
self._log_and_notify(tr(TR.SYNC_MEDIA_ABORTED)) self._log_and_notify(tr(TR.SYNC_MEDIA_ABORTED))
return return
elif isinstance(exc, NetworkError):
# avoid popups for network errors
self._log_and_notify(str(exc))
return
self._log_and_notify(tr(TR.SYNC_MEDIA_FAILED)) self._log_and_notify(tr(TR.SYNC_MEDIA_FAILED))
showWarning(str(exc)) showWarning(str(exc))