Deal with network errors separately

This commit is contained in:
Vishnu Mohandas 2021-03-07 10:55:07 +05:30
parent f83e52f7c7
commit 60a9fd5b73

View file

@ -112,10 +112,13 @@ class SyncService {
Bus.instance.fire(SyncStatusUpdate(SyncStatus.error, Bus.instance.fire(SyncStatusUpdate(SyncStatus.error,
error: StorageLimitExceededError())); error: StorageLimitExceededError()));
} catch (e, s) { } catch (e, s) {
final errorCode = e.error?.osError?.errorCode; if (e is DioError) {
if (errorCode == 111 || errorCode == 7) { final errorCode = e.error?.osError?.errorCode;
Bus.instance.fire(SyncStatusUpdate(SyncStatus.paused, if (errorCode == 111 || errorCode == 7) {
reason: "waiting for network...")); Bus.instance.fire(SyncStatusUpdate(SyncStatus.paused,
reason: "waiting for network..."));
return;
}
} else { } else {
_logger.severe("backup failed", e, s); _logger.severe("backup failed", e, s);
Bus.instance Bus.instance