Skip to content

Commit a434078

Browse files
committed
store: Show error message when replacing event queue.
Fixes: #555 Signed-off-by: Zixuan James Li <[email protected]>
1 parent e5716c7 commit a434078

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

assets/l10n/app_en.arb

+4
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@
174174
"error": {"type": "String", "example": "Network request failed: HTTP status 500"}
175175
}
176176
},
177+
"errorReconnectingToServer": "Reconnecting to server...",
178+
"@errorReconnectingToServer": {
179+
"description": "Message when reconnecting to the server."
180+
},
177181
"errorSharingFailed": "Sharing failed",
178182
"@errorSharingFailed": {
179183
"description": "Error message when sharing a message failed."

lib/model/store.dart

+1
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ class UpdateMachine {
789789
switch (e) {
790790
case ZulipApiException(code: 'BAD_EVENT_QUEUE_ID'):
791791
assert(debugLog('Lost event queue for $store. Replacing…'));
792+
reportErrorToUserInSnackBar(localizations.errorReconnectingToServer);
792793
await store._globalStore._reloadPerAccount(store.accountId);
793794
dispose();
794795
debugLog('… Event queue replaced.');

test/model/store_test.dart

+2
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,9 @@ void main() {
406406
});
407407
updateMachine.debugAdvanceLoop();
408408
async.flushMicrotasks();
409+
check(debugLastReportedError).isNull();
409410
await Future<void>.delayed(Duration.zero);
411+
check(debugTakeLastReportedError()).isNotNull().contains('Reconnecting to server.');
410412
check(store).isLoading.isTrue();
411413

412414
// The global store has a new store.

0 commit comments

Comments
 (0)