Fix connection error not handled in Photos

This commit is contained in:
Ming Ming 2022-10-29 13:50:14 +08:00
parent afa32c4299
commit 054d6bbae5

View file

@ -208,7 +208,15 @@ class ScanAccountDirBloc
}
stopwatch.reset();
final hasUpdate = await _syncOnline(ev);
final bool hasUpdate;
try {
hasUpdate = await _syncOnline(ev);
} catch (e, stackTrace) {
_log.shout("[_onEventQuery] Exception while request", e, stackTrace);
emit(ScanAccountDirBlocFailure(
cacheFiles.where((f) => file_util.isSupportedFormat(f)).toList(), e));
return;
}
_log.info(
"[_onEventQuery] Elapsed time (_syncOnline): ${stopwatch.elapsedMilliseconds}ms, hasUpdate: $hasUpdate");
if (hasUpdate) {