Browse Source

Fixed error handling on 'Collect event photos'

ashilkn 2 years ago
parent
commit
d7fc4b9b01
2 changed files with 9 additions and 8 deletions
  1. 1 1
      lib/services/collections_service.dart
  2. 8 7
      lib/ui/collection_action_sheet.dart

+ 1 - 1
lib/services/collections_service.dart

@@ -646,7 +646,7 @@ class CollectionsService {
       }
       rethrow;
     } catch (e, s) {
-      _logger.severe("failed to rename collection", e, s);
+      _logger.severe("failed to update ShareUrl", e, s);
       rethrow;
     }
   }

+ 8 - 7
lib/ui/collection_action_sheet.dart

@@ -417,13 +417,14 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
         showToast(context, "This album already has a collaborative link");
         return Future.value(false);
       } else {
-        CollectionsService.instance
-            .updateShareUrl(collection, {'enableCollect': true}).then(
-          (value) => true,
-          onError: (e, s) {
-            return false;
-          },
-        );
+        try {
+          await CollectionsService.instance
+              .updateShareUrl(collection, {'enableCollect': true});
+          return true;
+        } catch (e) {
+          showGenericErrorDialog(context: context);
+          return false;
+        }
       }
     }
     final bool result = await collectionActions.enableUrl(