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/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/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/features/login/domain/model/recent_login_url.dart';
|
||||||
|
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
|
||||||
|
|
||||||
class LoginUrlDataSourceImpl implements LoginUrlDataSource {
|
class LoginUrlDataSourceImpl implements LoginUrlDataSource {
|
||||||
|
|
||||||
final RecentLoginUrlCacheClient _recentLoginUrlCacheClient;
|
final RecentLoginUrlCacheClient _recentLoginUrlCacheClient;
|
||||||
|
final ExceptionThrower _exceptionThrower;
|
||||||
LoginUrlDataSourceImpl(this._recentLoginUrlCacheClient);
|
|
||||||
|
LoginUrlDataSourceImpl(this._recentLoginUrlCacheClient, this._exceptionThrower);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> saveLoginUrl(RecentLoginUrl recentLoginUrl) {
|
Future<void> saveLoginUrl(RecentLoginUrl recentLoginUrl) {
|
||||||
@@ -23,7 +25,7 @@ class LoginUrlDataSourceImpl implements LoginUrlDataSource {
|
|||||||
recentLoginUrl.toRecentLoginUrlCache());
|
recentLoginUrl.toRecentLoginUrlCache());
|
||||||
}
|
}
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
throw error;
|
_exceptionThrower.throwException(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +47,7 @@ class LoginUrlDataSourceImpl implements LoginUrlDataSource {
|
|||||||
|
|
||||||
return newListRecentSUrl;
|
return newListRecentSUrl;
|
||||||
}).catchError((error) {
|
}).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/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/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/features/login/domain/model/recent_login_username.dart';
|
||||||
|
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
|
||||||
|
|
||||||
class LoginUsernameDataSourceImpl implements LoginUsernameDataSource {
|
class LoginUsernameDataSourceImpl implements LoginUsernameDataSource {
|
||||||
final RecentLoginUsernameCacheClient _recentLoginUsernameCacheClient;
|
|
||||||
|
|
||||||
LoginUsernameDataSourceImpl(this._recentLoginUsernameCacheClient);
|
final RecentLoginUsernameCacheClient _recentLoginUsernameCacheClient;
|
||||||
|
final ExceptionThrower _exceptionThrower;
|
||||||
|
|
||||||
|
LoginUsernameDataSourceImpl(this._recentLoginUsernameCacheClient, this._exceptionThrower);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<RecentLoginUsername>> getAllRecentLoginUsernamesLatest({int? limit, String? pattern}) {
|
Future<List<RecentLoginUsername>> getAllRecentLoginUsernamesLatest({int? limit, String? pattern}) {
|
||||||
@@ -26,7 +29,7 @@ class LoginUsernameDataSourceImpl implements LoginUsernameDataSource {
|
|||||||
? listValidRecentUsername.sublist(0, newLimit)
|
? listValidRecentUsername.sublist(0, newLimit)
|
||||||
: listValidRecentUsername;
|
: listValidRecentUsername;
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
throw error;
|
_exceptionThrower.throwException(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +45,7 @@ class LoginUsernameDataSourceImpl implements LoginUsernameDataSource {
|
|||||||
recentLoginUsername.toRecentLoginUsernameCache());
|
recentLoginUsername.toRecentLoginUsernameCache());
|
||||||
}
|
}
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
throw error;
|
_exceptionThrower.throwException(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,11 +102,11 @@ class LoginBindings extends BaseBindings {
|
|||||||
Get.find<AccountCacheManager>(),
|
Get.find<AccountCacheManager>(),
|
||||||
Get.find<CacheExceptionThrower>()));
|
Get.find<CacheExceptionThrower>()));
|
||||||
Get.lazyPut(() => LoginUrlDataSourceImpl(
|
Get.lazyPut(() => LoginUrlDataSourceImpl(
|
||||||
Get.find<RecentLoginUrlCacheClient>()
|
Get.find<RecentLoginUrlCacheClient>(),
|
||||||
));
|
Get.find<CacheExceptionThrower>()));
|
||||||
Get.lazyPut(() => LoginUsernameDataSourceImpl(
|
Get.lazyPut(() => LoginUsernameDataSourceImpl(
|
||||||
Get.find<RecentLoginUsernameCacheClient>()
|
Get.find<RecentLoginUsernameCacheClient>(),
|
||||||
));
|
Get.find<CacheExceptionThrower>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Reference in New Issue
Block a user