Skip to content

Commit 0ab829e

Browse files
committed
TF-4081 Fix return type mismatch in Future.catchError handler
1 parent ef8dcd9 commit 0ab829e

File tree

54 files changed

+738
-201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+738
-201
lines changed

lib/features/caching/clients/hive_cache_version_client.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,19 @@ class HiveCacheVersionClient extends CacheVersionClient {
1717
return Future.sync(() {
1818
final latestVersion = _sharedPreferences.getInt(versionKey);
1919
return latestVersion;
20-
}).catchError(_exceptionThrower.throwException);
20+
}).catchError((error, stackTrace) async {
21+
await _exceptionThrower.throwException(error, stackTrace);
22+
throw error;
23+
});
2124
}
2225

2326
@override
2427
Future<bool> storeVersion(int newVersion) {
2528
return Future.sync(() async {
2629
return await _sharedPreferences.setInt(versionKey, newVersion);
27-
}).catchError(_exceptionThrower.throwException);
30+
}).catchError((error, stackTrace) async {
31+
await _exceptionThrower.throwException(error, stackTrace);
32+
throw error;
33+
});
2834
}
2935
}

lib/features/cleanup/data/datasource_impl/cleanup_datasource_impl.dart

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,39 @@ class CleanupDataSourceImpl extends CleanupDataSource {
3030
Future<void> cleanEmailCache(EmailCleanupRule cleanupRule) {
3131
return Future.sync(() async {
3232
return await emailCacheManager.clean(cleanupRule);
33-
}).catchError(_exceptionThrower.throwException);
33+
}).catchError((error, stackTrace) async {
34+
await _exceptionThrower.throwException(error, stackTrace);
35+
throw error;
36+
});
3437
}
3538

3639
@override
3740
Future<void> cleanRecentSearchCache(RecentSearchCleanupRule cleanupRule) {
3841
return Future.sync(() async {
3942
return await recentSearchCacheManager.clean(cleanupRule);
40-
}).catchError(_exceptionThrower.throwException);
43+
}).catchError((error, stackTrace) async {
44+
await _exceptionThrower.throwException(error, stackTrace);
45+
throw error;
46+
});
4147
}
4248

4349
@override
4450
Future<void> cleanRecentLoginUrlCache(RecentLoginUrlCleanupRule cleanupRule) {
4551
return Future.sync(() async {
4652
return await recentLoginUrlCacheManager.clean(cleanupRule);
47-
}).catchError(_exceptionThrower.throwException);
53+
}).catchError((error, stackTrace) async {
54+
await _exceptionThrower.throwException(error, stackTrace);
55+
throw error;
56+
});
4857
}
4958

5059
@override
5160
Future<void> cleanRecentLoginUsernameCache(RecentLoginUsernameCleanupRule cleanupRule) {
5261
return Future.sync(() async {
5362
return await recentLoginUsernameCacheManager.clean(cleanupRule);
54-
}).catchError(_exceptionThrower.throwException);
63+
}).catchError((error, stackTrace) async {
64+
await _exceptionThrower.throwException(error, stackTrace);
65+
throw error;
66+
});
5567
}
5668
}

lib/features/composer/data/datasource_impl/composer_datasource_impl.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class ComposerDataSourceImpl extends ComposerDataSource {
3131
filePath: fileInfo.filePath,
3232
maxWidth: maxWidth,
3333
compress: compress);
34-
}).catchError(_exceptionThrower.throwException);
34+
}).catchError((error, stackTrace) async {
35+
await _exceptionThrower.throwException(error, stackTrace);
36+
throw error;
37+
});
3538
}
3639
}

lib/features/composer/data/datasource_impl/contact_datasource_impl.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ class ContactDataSourceImpl extends ContactDataSource {
2525
return <DeviceContact>[];
2626
}
2727
}
28-
}).catchError(_exceptionThrower.throwException);
28+
}).catchError((error, stackTrace) async {
29+
await _exceptionThrower.throwException(error, stackTrace);
30+
throw error;
31+
});
2932
}
3033

3134
List<DeviceContact> _toDeviceContact(contact_service.Contact contact) {

lib/features/contact/data/datasource_impl/tmail_contact_datasource_impl.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ class TMailContactDataSourceImpl extends AutoCompleteDataSource {
1818
return Future.sync(() async {
1919
final listContacts = await _contactAPI.getAutoComplete(autoCompletePattern);
2020
return listContacts.map((contact) => contact.toEmailAddress()).toList();
21-
}).catchError(_exceptionThrower.throwException);
21+
}).catchError((error, stackTrace) async {
22+
await _exceptionThrower.throwException(error, stackTrace);
23+
throw error;
24+
});
2225
}
2326
}

lib/features/email/data/datasource_impl/calendar_event_datasource_impl.dart

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ class CalendarEventDataSourceImpl extends CalendarEventDataSource {
2020
Future<List<BlobCalendarEvent>> parse(AccountId accountId, Set<Id> blobIds) {
2121
return Future.sync(() async {
2222
return await _calendarEventAPI.parse(accountId, blobIds);
23-
}).catchError(_exceptionThrower.throwException);
23+
}).catchError((error, stackTrace) async {
24+
await _exceptionThrower.throwException(error, stackTrace);
25+
throw error;
26+
});
2427
}
2528

2629
@override
@@ -30,7 +33,10 @@ class CalendarEventDataSourceImpl extends CalendarEventDataSource {
3033
String? language) {
3134
return Future.sync(() async {
3235
return await _calendarEventAPI.acceptEventInvitation(accountId, blobIds, language);
33-
}).catchError(_exceptionThrower.throwException);
36+
}).catchError((error, stackTrace) async {
37+
await _exceptionThrower.throwException(error, stackTrace);
38+
throw error;
39+
});
3440
}
3541

3642
@override
@@ -40,7 +46,10 @@ class CalendarEventDataSourceImpl extends CalendarEventDataSource {
4046
String? language) {
4147
return Future.sync(() async {
4248
return await _calendarEventAPI.maybeEventInvitation(accountId, blobIds, language);
43-
}).catchError(_exceptionThrower.throwException);
49+
}).catchError((error, stackTrace) async {
50+
await _exceptionThrower.throwException(error, stackTrace);
51+
throw error;
52+
});
4453
}
4554

4655
@override
@@ -50,7 +59,10 @@ class CalendarEventDataSourceImpl extends CalendarEventDataSource {
5059
String? language) {
5160
return Future.sync(() async {
5261
return await _calendarEventAPI.rejectEventInvitation(accountId, blobIds, language);
53-
}).catchError(_exceptionThrower.throwException);
62+
}).catchError((error, stackTrace) async {
63+
await _exceptionThrower.throwException(error, stackTrace);
64+
throw error;
65+
});
5466
}
5567

5668
@override
@@ -60,6 +72,9 @@ class CalendarEventDataSourceImpl extends CalendarEventDataSource {
6072
) {
6173
return Future.sync(() async {
6274
return await _calendarEventAPI.acceptCounterEvent(accountId, blobIds);
63-
}).catchError(_exceptionThrower.throwException);
75+
}).catchError((error, stackTrace) async {
76+
await _exceptionThrower.throwException(error, stackTrace);
77+
throw error;
78+
});
6479
}
6580
}

0 commit comments

Comments
 (0)