TF-3487 Handle get mailbox failure
This commit is contained in:
@@ -87,17 +87,12 @@ class MailboxRepositoryImpl extends MailboxRepository {
|
|||||||
Session session,
|
Session session,
|
||||||
{Properties? properties}
|
{Properties? properties}
|
||||||
) async {
|
) async {
|
||||||
try {
|
final jmapMailboxResponse = await mapDataSource[DataSourceType.network]!.getAllMailbox(
|
||||||
final jmapMailboxResponse = await mapDataSource[DataSourceType.network]!.getAllMailbox(
|
session,
|
||||||
session,
|
accountId,
|
||||||
accountId,
|
properties: properties);
|
||||||
properties: properties);
|
log('MailboxRepositoryImpl::_getAllMailboxFromJMAP: MAILBOX_NETWORK = ${jmapMailboxResponse.mailboxes.length} | STATE_NETWORK = ${jmapMailboxResponse.state}');
|
||||||
log('MailboxRepositoryImpl::_getAllMailboxFromJMAP: MAILBOX_NETWORK = ${jmapMailboxResponse.mailboxes.length} | STATE_NETWORK = ${jmapMailboxResponse.state}');
|
return jmapMailboxResponse;
|
||||||
return jmapMailboxResponse;
|
|
||||||
} catch (e) {
|
|
||||||
logError('MailboxRepositoryImpl::_getAllMailboxFromJMAP: Exception: $e');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _syncNewInCache(
|
Future<void> _syncNewInCache(
|
||||||
|
|||||||
@@ -19,5 +19,5 @@ class GetAllMailboxSuccess extends UIState {
|
|||||||
|
|
||||||
class GetAllMailboxFailure extends FeatureFailure {
|
class GetAllMailboxFailure extends FeatureFailure {
|
||||||
|
|
||||||
GetAllMailboxFailure(dynamic exception) : super(exception: exception);
|
GetAllMailboxFailure(dynamic exception, {super.onRetry}) : super(exception: exception);
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,10 @@ class GetAllMailboxInteractor {
|
|||||||
properties: properties)
|
properties: properties)
|
||||||
.map(_toGetMailboxState);
|
.map(_toGetMailboxState);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
yield Left<Failure, Success>(GetAllMailboxFailure(e));
|
yield Left<Failure, Success>(GetAllMailboxFailure(
|
||||||
|
e,
|
||||||
|
onRetry: execute(session, accountId, properties: properties),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -232,6 +232,7 @@ class MailboxController extends BaseMailboxController
|
|||||||
(failure) {
|
(failure) {
|
||||||
if (failure is GetAllMailboxFailure) {
|
if (failure is GetAllMailboxFailure) {
|
||||||
mailboxDashBoardController.updateRefreshAllMailboxState(Left(RefreshAllMailboxFailure()));
|
mailboxDashBoardController.updateRefreshAllMailboxState(Left(RefreshAllMailboxFailure()));
|
||||||
|
showRetryToast(failure);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(success) {
|
(success) {
|
||||||
|
|||||||
@@ -67,12 +67,9 @@ void main() {
|
|||||||
|
|
||||||
final streamMailboxResponses = mailboxRepository.getAllMailbox(sessionFixture, accountIdFixture);
|
final streamMailboxResponses = mailboxRepository.getAllMailbox(sessionFixture, accountIdFixture);
|
||||||
|
|
||||||
final listMailboxResponse = await streamMailboxResponses.toList();
|
await expectLater(
|
||||||
|
streamMailboxResponses,
|
||||||
expect(listMailboxResponse.length, 1);
|
emitsInOrder([
|
||||||
expect(
|
|
||||||
listMailboxResponse,
|
|
||||||
containsAllInOrder([
|
|
||||||
CacheMailboxResponse(
|
CacheMailboxResponse(
|
||||||
mailboxes: [
|
mailboxes: [
|
||||||
MailboxFixtures.mailboxA,
|
MailboxFixtures.mailboxA,
|
||||||
@@ -81,7 +78,8 @@ void main() {
|
|||||||
MailboxFixtures.mailboxD,
|
MailboxFixtures.mailboxD,
|
||||||
],
|
],
|
||||||
state: StateFixtures.currentMailboxState
|
state: StateFixtures.currentMailboxState
|
||||||
)
|
),
|
||||||
|
emitsError(isA<NotFoundMailboxException>())
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user