Browse Source

gracefully handle failure in freespace api call

Neeraj Gupta 3 years ago
parent
commit
bbd24581ad
1 changed files with 9 additions and 1 deletions
  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 {
           onTap: () async {
             final dialog = createProgressDialog(context, "calculating...");
             final dialog = createProgressDialog(context, "calculating...");
             await dialog.show();
             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();
             await dialog.hide();
             if (status.localIDs.isEmpty) {
             if (status.localIDs.isEmpty) {
               showErrorDialog(context, "✨ all clear",
               showErrorDialog(context, "✨ all clear",