Skip to content

Commit 6ddd6f4

Browse files
committed
login: Show error dialog on get-server-settings failure
Fixes-partly: zulip#35
1 parent 28b85cb commit 6ddd6f4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/widgets/login.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,19 @@ class _AddAccountPageState extends State<AddAccountPage> {
147147
_inProgress = true;
148148
});
149149
try {
150-
final serverSettings = await getServerSettings(realmUrl: url!);
150+
final GetServerSettingsResult serverSettings;
151+
try {
152+
serverSettings = await getServerSettings(realmUrl: url!);
153+
} catch (e) {
154+
if (!context.mounted) {
155+
return;
156+
}
157+
// TODO(#35) give more helpful feedback; see `fetchServerSettings`
158+
// in zulip-mobile's src/message/fetchActions.js. Needs #37.
159+
showErrorDialog(context: context,
160+
title: 'Could not connect', message: 'Failed to connect to server:\n$url');
161+
return;
162+
}
151163
// https://github.com/dart-lang/linter/issues/4007
152164
// ignore: use_build_context_synchronously
153165
if (!context.mounted) {

0 commit comments

Comments
 (0)