TF-1115 Implement catch exception for LoginCacheDataSource
This commit is contained in:
@@ -3,12 +3,14 @@ import 'package:tmail_ui_user/features/login/data/datasource/login_url_datasourc
|
||||
import 'package:tmail_ui_user/features/login/data/model/recent_login_url_cache.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/extensions/list_recent_login_url_extension.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/model/recent_login_url.dart';
|
||||
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
|
||||
|
||||
class LoginUrlDataSourceImpl implements LoginUrlDataSource {
|
||||
|
||||
final RecentLoginUrlCacheClient _recentLoginUrlCacheClient;
|
||||
|
||||
LoginUrlDataSourceImpl(this._recentLoginUrlCacheClient);
|
||||
final ExceptionThrower _exceptionThrower;
|
||||
|
||||
LoginUrlDataSourceImpl(this._recentLoginUrlCacheClient, this._exceptionThrower);
|
||||
|
||||
@override
|
||||
Future<void> saveLoginUrl(RecentLoginUrl recentLoginUrl) {
|
||||
@@ -23,7 +25,7 @@ class LoginUrlDataSourceImpl implements LoginUrlDataSource {
|
||||
recentLoginUrl.toRecentLoginUrlCache());
|
||||
}
|
||||
}).catchError((error) {
|
||||
throw error;
|
||||
_exceptionThrower.throwException(error);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -45,7 +47,7 @@ class LoginUrlDataSourceImpl implements LoginUrlDataSource {
|
||||
|
||||
return newListRecentSUrl;
|
||||
}).catchError((error) {
|
||||
throw error;
|
||||
_exceptionThrower.throwException(error);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,14 @@ import 'package:tmail_ui_user/features/login/data/datasource/login_username_data
|
||||
import 'package:tmail_ui_user/features/login/data/model/recent_login_username_cache.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/extensions/list_recent_login_username_extension.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/model/recent_login_username.dart';
|
||||
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
|
||||
|
||||
class LoginUsernameDataSourceImpl implements LoginUsernameDataSource {
|
||||
final RecentLoginUsernameCacheClient _recentLoginUsernameCacheClient;
|
||||
|
||||
LoginUsernameDataSourceImpl(this._recentLoginUsernameCacheClient);
|
||||
final RecentLoginUsernameCacheClient _recentLoginUsernameCacheClient;
|
||||
final ExceptionThrower _exceptionThrower;
|
||||
|
||||
LoginUsernameDataSourceImpl(this._recentLoginUsernameCacheClient, this._exceptionThrower);
|
||||
|
||||
@override
|
||||
Future<List<RecentLoginUsername>> getAllRecentLoginUsernamesLatest({int? limit, String? pattern}) {
|
||||
@@ -26,7 +29,7 @@ class LoginUsernameDataSourceImpl implements LoginUsernameDataSource {
|
||||
? listValidRecentUsername.sublist(0, newLimit)
|
||||
: listValidRecentUsername;
|
||||
}).catchError((error) {
|
||||
throw error;
|
||||
_exceptionThrower.throwException(error);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,7 +45,7 @@ class LoginUsernameDataSourceImpl implements LoginUsernameDataSource {
|
||||
recentLoginUsername.toRecentLoginUsernameCache());
|
||||
}
|
||||
}).catchError((error) {
|
||||
throw error;
|
||||
_exceptionThrower.throwException(error);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -102,11 +102,11 @@ class LoginBindings extends BaseBindings {
|
||||
Get.find<AccountCacheManager>(),
|
||||
Get.find<CacheExceptionThrower>()));
|
||||
Get.lazyPut(() => LoginUrlDataSourceImpl(
|
||||
Get.find<RecentLoginUrlCacheClient>()
|
||||
));
|
||||
Get.find<RecentLoginUrlCacheClient>(),
|
||||
Get.find<CacheExceptionThrower>()));
|
||||
Get.lazyPut(() => LoginUsernameDataSourceImpl(
|
||||
Get.find<RecentLoginUsernameCacheClient>()
|
||||
));
|
||||
Get.find<RecentLoginUsernameCacheClient>(),
|
||||
Get.find<CacheExceptionThrower>()));
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user