TF-1115 Implement catch exception for StateDataSource
This commit is contained in:
@@ -85,7 +85,7 @@ class ComposerBindings extends BaseBindings {
|
|||||||
Get.find<HtmlAnalyzer>(),
|
Get.find<HtmlAnalyzer>(),
|
||||||
Get.find<DioClient>(),
|
Get.find<DioClient>(),
|
||||||
Get.find<RemoteExceptionThrower>()));
|
Get.find<RemoteExceptionThrower>()));
|
||||||
Get.lazyPut(() => StateDataSourceImpl(Get.find<StateCacheClient>()));
|
Get.lazyPut(() => StateDataSourceImpl(Get.find<StateCacheClient>(), Get.find<CacheExceptionThrower>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class DestinationPickerBindings extends BaseBindings {
|
|||||||
Get.lazyPut(() => MailboxCacheDataSourceImpl(
|
Get.lazyPut(() => MailboxCacheDataSourceImpl(
|
||||||
Get.find<MailboxCacheManager>(),
|
Get.find<MailboxCacheManager>(),
|
||||||
Get.find<CacheExceptionThrower>()));
|
Get.find<CacheExceptionThrower>()));
|
||||||
Get.lazyPut(() => StateDataSourceImpl(Get.find<StateCacheClient>()));
|
Get.lazyPut(() => StateDataSourceImpl(Get.find<StateCacheClient>(), Get.find<CacheExceptionThrower>()));
|
||||||
Get.lazyPut(() => EmailDataSourceImpl(
|
Get.lazyPut(() => EmailDataSourceImpl(
|
||||||
Get.find<EmailAPI>(),
|
Get.find<EmailAPI>(),
|
||||||
Get.find<RemoteExceptionThrower>()));
|
Get.find<RemoteExceptionThrower>()));
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class EmailBindings extends BaseBindings {
|
|||||||
Get.find<HtmlAnalyzer>(),
|
Get.find<HtmlAnalyzer>(),
|
||||||
Get.find<DioClient>(),
|
Get.find<DioClient>(),
|
||||||
Get.find<RemoteExceptionThrower>()));
|
Get.find<RemoteExceptionThrower>()));
|
||||||
Get.lazyPut(() => StateDataSourceImpl(Get.find<StateCacheClient>()));
|
Get.lazyPut(() => StateDataSourceImpl(Get.find<StateCacheClient>(), Get.find<CacheExceptionThrower>()));
|
||||||
Get.lazyPut(() => AuthenticationOIDCDataSourceImpl(
|
Get.lazyPut(() => AuthenticationOIDCDataSourceImpl(
|
||||||
Get.find<OIDCHttpClient>(),
|
Get.find<OIDCHttpClient>(),
|
||||||
Get.find<AuthenticationClientBase>(),
|
Get.find<AuthenticationClientBase>(),
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ import 'package:tmail_ui_user/features/mailbox/data/datasource/state_datasource.
|
|||||||
import 'package:tmail_ui_user/features/mailbox/data/model/state_cache.dart';
|
import 'package:tmail_ui_user/features/mailbox/data/model/state_cache.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox/data/model/state_type.dart';
|
import 'package:tmail_ui_user/features/mailbox/data/model/state_type.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox/data/extensions/state_cache_extension.dart';
|
import 'package:tmail_ui_user/features/mailbox/data/extensions/state_cache_extension.dart';
|
||||||
|
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
|
||||||
|
|
||||||
class StateDataSourceImpl extends StateDataSource {
|
class StateDataSourceImpl extends StateDataSource {
|
||||||
|
|
||||||
final StateCacheClient _stateCacheClient;
|
final StateCacheClient _stateCacheClient;
|
||||||
|
final ExceptionThrower _exceptionThrower;
|
||||||
|
|
||||||
StateDataSourceImpl(this._stateCacheClient);
|
StateDataSourceImpl(this._stateCacheClient, this._exceptionThrower);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<State?> getState(StateType stateType) {
|
Future<State?> getState(StateType stateType) {
|
||||||
@@ -18,7 +20,7 @@ class StateDataSourceImpl extends StateDataSource {
|
|||||||
final stateCache = await _stateCacheClient.getItem(stateType.value);
|
final stateCache = await _stateCacheClient.getItem(stateType.value);
|
||||||
return stateCache?.toState();
|
return stateCache?.toState();
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
throw error;
|
_exceptionThrower.throwException(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,7 +34,7 @@ class StateDataSourceImpl extends StateDataSource {
|
|||||||
return await _stateCacheClient.insertItem(stateCache.type.value, stateCache);
|
return await _stateCacheClient.insertItem(stateCache.type.value, stateCache);
|
||||||
}
|
}
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
throw error;
|
_exceptionThrower.throwException(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ class MailboxBindings extends BaseBindings {
|
|||||||
Get.lazyPut(() => MailboxCacheDataSourceImpl(
|
Get.lazyPut(() => MailboxCacheDataSourceImpl(
|
||||||
Get.find<MailboxCacheManager>(),
|
Get.find<MailboxCacheManager>(),
|
||||||
Get.find<CacheExceptionThrower>()));
|
Get.find<CacheExceptionThrower>()));
|
||||||
Get.lazyPut(() => StateDataSourceImpl(Get.find<StateCacheClient>()));
|
Get.lazyPut(() => StateDataSourceImpl(Get.find<StateCacheClient>(), Get.find<CacheExceptionThrower>()));
|
||||||
Get.lazyPut(() => EmailDataSourceImpl(
|
Get.lazyPut(() => EmailDataSourceImpl(
|
||||||
Get.find<EmailAPI>(),
|
Get.find<EmailAPI>(),
|
||||||
Get.find<RemoteExceptionThrower>()));
|
Get.find<RemoteExceptionThrower>()));
|
||||||
|
|||||||
+1
-1
@@ -158,7 +158,7 @@ class MailboxDashBoardBindings extends BaseBindings {
|
|||||||
Get.find<ThreadIsolateWorker>(),
|
Get.find<ThreadIsolateWorker>(),
|
||||||
Get.find<RemoteExceptionThrower>()));
|
Get.find<RemoteExceptionThrower>()));
|
||||||
Get.lazyPut(() => LocalThreadDataSourceImpl(Get.find<EmailCacheManager>()));
|
Get.lazyPut(() => LocalThreadDataSourceImpl(Get.find<EmailCacheManager>()));
|
||||||
Get.lazyPut(() => StateDataSourceImpl(Get.find<StateCacheClient>()));
|
Get.lazyPut(() => StateDataSourceImpl(Get.find<StateCacheClient>(), Get.find<CacheExceptionThrower>()));
|
||||||
Get.lazyPut(() => MailboxDataSourceImpl(
|
Get.lazyPut(() => MailboxDataSourceImpl(
|
||||||
Get.find<MailboxAPI>(),
|
Get.find<MailboxAPI>(),
|
||||||
Get.find<MailboxIsolateWorker>(),
|
Get.find<MailboxIsolateWorker>(),
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class RulesFilterCreatorBindings extends BaseBindings {
|
|||||||
Get.lazyPut(() => MailboxCacheDataSourceImpl(
|
Get.lazyPut(() => MailboxCacheDataSourceImpl(
|
||||||
Get.find<MailboxCacheManager>(),
|
Get.find<MailboxCacheManager>(),
|
||||||
Get.find<CacheExceptionThrower>()));
|
Get.find<CacheExceptionThrower>()));
|
||||||
Get.lazyPut(() => StateDataSourceImpl(Get.find<StateCacheClient>()));
|
Get.lazyPut(() => StateDataSourceImpl(Get.find<StateCacheClient>(), Get.find<CacheExceptionThrower>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class ThreadBindings extends BaseBindings {
|
|||||||
Get.find<ThreadIsolateWorker>(),
|
Get.find<ThreadIsolateWorker>(),
|
||||||
Get.find<RemoteExceptionThrower>()));
|
Get.find<RemoteExceptionThrower>()));
|
||||||
Get.lazyPut(() => LocalThreadDataSourceImpl(Get.find<EmailCacheManager>()));
|
Get.lazyPut(() => LocalThreadDataSourceImpl(Get.find<EmailCacheManager>()));
|
||||||
Get.lazyPut(() => StateDataSourceImpl(Get.find<StateCacheClient>()));
|
Get.lazyPut(() => StateDataSourceImpl(Get.find<StateCacheClient>(), Get.find<CacheExceptionThrower>()));
|
||||||
Get.lazyPut(() => EmailDataSourceImpl(
|
Get.lazyPut(() => EmailDataSourceImpl(
|
||||||
Get.find<EmailAPI>(),
|
Get.find<EmailAPI>(),
|
||||||
Get.find<RemoteExceptionThrower>()));
|
Get.find<RemoteExceptionThrower>()));
|
||||||
|
|||||||
Reference in New Issue
Block a user