Skip to content

Commit 94d4729

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

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

assets/l10n/app_en.arb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@
190190
"error": {"type": "String", "example": "Network request failed: HTTP status 500"}
191191
}
192192
},
193+
"errorReconnectingToServer": "Reconnecting to {url}…",
194+
"@errorReconnectingToServer": {
195+
"url": {"type": "String", "example": "http://example.com/"},
196+
"description": "Message when reconnecting to the server."
197+
},
193198
"errorSharingFailed": "Sharing failed",
194199
"@errorSharingFailed": {
195200
"description": "Error message when sharing a message failed."

lib/model/store.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@ class UpdateMachine {
794794
switch (e) {
795795
case ZulipApiException(code: 'BAD_EVENT_QUEUE_ID'):
796796
assert(debugLog('Lost event queue for $store. Replacing…'));
797+
reportErrorToUser(localizations.errorReconnectingToServer(serverUrl));
797798
await store._globalStore._reloadPerAccount(store.accountId);
798799
dispose();
799800
debugLog('… Event queue replaced.');

test/model/store_test.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,10 @@ void main() {
406406
});
407407
updateMachine.debugAdvanceLoop();
408408
async.flushMicrotasks();
409+
check(debugLastReportedError).isNull();
409410
await Future<void>.delayed(Duration.zero);
411+
check(debugTakeLastReportedError()).isNotNull()
412+
.contains('Reconnecting to ${eg.realmUrl.origin}…');
410413
check(store).isLoading.isTrue();
411414

412415
// The global store has a new store.

0 commit comments

Comments
 (0)