Ver código fonte

gracefully handle failure in freespace api call

Neeraj Gupta 3 anos atrás
pai
commit
bbd24581ad
1 arquivos alterados com 9 adições e 1 exclusões
  1. 9 1
      lib/ui/settings/backup_section_widget.dart

+ 9 - 1
lib/ui/settings/backup_section_widget.dart

@@ -104,7 +104,15 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
           onTap: () async {
             final dialog = createProgressDialog(context, "calculating...");
             await dialog.show();
-            final status = await SyncService.instance.getBackupStatus();
+            BackupStatus status;
+            try {
+              status = await SyncService.instance.getBackupStatus();
+            } catch (e, s) {
+              await dialog.hide();
+              showGenericErrorDialog(context);
+              return;
+            }
+
             await dialog.hide();
             if (status.localIDs.isEmpty) {
               showErrorDialog(context, "✨ all clear",