TF-1115 Implement catch exception for SearchDataSource
This commit is contained in:
@@ -4,12 +4,14 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/data/datasource/search_
|
|||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/data/model/recent_search_cache.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/data/model/recent_search_cache.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/extensions/list_recent_search_extension.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/extensions/list_recent_search_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/model/recent_search.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/model/recent_search.dart';
|
||||||
|
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
|
||||||
|
|
||||||
class SearchDataSourceImpl extends SearchDataSource {
|
class SearchDataSourceImpl extends SearchDataSource {
|
||||||
|
|
||||||
final RecentSearchCacheClient _recentSearchCacheClient;
|
final RecentSearchCacheClient _recentSearchCacheClient;
|
||||||
|
final ExceptionThrower _exceptionThrower;
|
||||||
|
|
||||||
SearchDataSourceImpl(this._recentSearchCacheClient);
|
SearchDataSourceImpl(this._recentSearchCacheClient, this._exceptionThrower);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> saveRecentSearch(RecentSearch recentSearch) {
|
Future<void> saveRecentSearch(RecentSearch recentSearch) {
|
||||||
@@ -24,7 +26,7 @@ class SearchDataSourceImpl extends SearchDataSource {
|
|||||||
recentSearch.toRecentSearchCache());
|
recentSearch.toRecentSearchCache());
|
||||||
}
|
}
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
throw error;
|
_exceptionThrower.throwException(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ class SearchDataSourceImpl extends SearchDataSource {
|
|||||||
|
|
||||||
return newListRecentSearch;
|
return newListRecentSearch;
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
throw error;
|
_exceptionThrower.throwException(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -152,7 +152,9 @@ class MailboxDashBoardBindings extends BaseBindings {
|
|||||||
Get.find<HtmlAnalyzer>(),
|
Get.find<HtmlAnalyzer>(),
|
||||||
Get.find<DioClient>(),
|
Get.find<DioClient>(),
|
||||||
Get.find<RemoteExceptionThrower>()));
|
Get.find<RemoteExceptionThrower>()));
|
||||||
Get.lazyPut(() => SearchDataSourceImpl(Get.find<RecentSearchCacheClient>()));
|
Get.lazyPut(() => SearchDataSourceImpl(
|
||||||
|
Get.find<RecentSearchCacheClient>(),
|
||||||
|
Get.find<CacheExceptionThrower>()));
|
||||||
Get.lazyPut(() => ThreadDataSourceImpl(
|
Get.lazyPut(() => ThreadDataSourceImpl(
|
||||||
Get.find<ThreadAPI>(),
|
Get.find<ThreadAPI>(),
|
||||||
Get.find<ThreadIsolateWorker>(),
|
Get.find<ThreadIsolateWorker>(),
|
||||||
|
|||||||
Reference in New Issue
Block a user