Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Pass back any exceptions/errors back to main isolate when thrown from a different isolate when using _getLocalIDsAndFilesFromAssets + catch and log in the main isolate so that its reported on sentry

ashilkn5ec52541bfa0
diff --git a/mobile/lib/services/local/local_sync_util.dart b/mobile/lib/services/local/local_sync_util.dart
index c37b37e954..12f273803a 100644
--- a/mobile/lib/services/local/local_sync_util.dart
+++ b/mobile/lib/services/local/local_sync_util.dart
@@ -34,17 +34,26 @@ Future<Tuple2<List<LocalPathAsset>, List<EnteFile>>> getLocalPathAssetsAndFiles(
if (assetsInPath.isEmpty) {
result = const Tuple2({}, []);
} else {
- result = await Computer.shared().compute(
- _getLocalIDsAndFilesFromAssets,
- param: <String, dynamic>{
- "pathEntity": pathEntity,
- "fromTime": fromTime,
- "alreadySeenLocalIDs": alreadySeenLocalIDs,
- "assetList": assetsInPath,
- },
- taskName:
- "getLocalPathAssetsAndFiles-${pathEntity.name}-count-${assetsInPath.length}",
- );
+ try {
+ result = await Computer.shared().compute(
+ _getLocalIDsAndFilesFromAssets,
+ param: <String, dynamic>{
+ "pathEntity": pathEntity,
+ "fromTime": fromTime,
+ "alreadySeenLocalIDs": alreadySeenLocalIDs,
+ "assetList": assetsInPath,
+ },
+ taskName:
+ "getLocalPathAssetsAndFiles-${pathEntity.name}-count-${assetsInPath.length}",
+ );
+ } catch (e) {
+ _logger.severe("_getLocalIDsAndFilesFromAssets failed", e);
+ _logger.info(
+ "Failed for pathEntity: ${pathEntity.name}",
+ );
+ result = const Tuple2({}, []);
+ }
+
alreadySeenLocalIDs.addAll(result.item1);
uniqueFiles.addAll(result.item2);
}
@@ -299,12 +308,8 @@ Future<Tuple2<Set<String>, List<EnteFile>>> _getLocalIDsAndFilesFromAssets(
(fromTime / ~1000);
if (!alreadySeenLocalIDs.contains(entity.id) &&
assetCreatedOrUpdatedAfterGivenTime) {
- try {
- final file = await EnteFile.fromAsset(pathEntity.name, entity);
- files.add(file);
- } catch (e) {
- _logger.severe(e);
- }
+ final file = await EnteFile.fromAsset(pathEntity.name, entity);
+ files.add(file);
}
}
return Tuple2(localIDs, files);