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,
error: StorageLimitExceededError()));
} catch (e, s) {
final errorCode = e.error?.osError?.errorCode;
if (errorCode == 111 || errorCode == 7) {
Bus.instance.fire(SyncStatusUpdate(SyncStatus.paused,
reason: "waiting for network..."));
if (e is DioError) {
final errorCode = e.error?.osError?.errorCode;
if (errorCode == 111 || errorCode == 7) {
Bus.instance.fire(SyncStatusUpdate(SyncStatus.paused,
reason: "waiting for network..."));
return;
}
} else {
_logger.severe("backup failed", e, s);
Bus.instance