From d6515bf5070a9e266ea3559342e08b3c0e21efd4 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Fri, 25 Jan 2019 15:11:24 +0100 Subject: [PATCH] GitHost AutoConfigure: Show the error It looks super ugly, but it's better than not showing anything. --- lib/screens/githostsetup_autoconfigure.dart | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/screens/githostsetup_autoconfigure.dart b/lib/screens/githostsetup_autoconfigure.dart index 088d5d24..2a18b1be 100644 --- a/lib/screens/githostsetup_autoconfigure.dart +++ b/lib/screens/githostsetup_autoconfigure.dart @@ -31,15 +31,22 @@ class GitHostSetupAutoConfigureState extends State { gitHost.init(() async { print("GitHost Initalized: " + widget.gitHostType.toString()); - var repo = await gitHost.createRepo("journal"); - var publicKey = await generateSSHKeys(comment: "GitJournal"); - await gitHost.addDeployKey(publicKey, repo.fullName); - + GitRepo repo; + try { + repo = await gitHost.createRepo("journal"); + var publicKey = await generateSSHKeys(comment: "GitJournal"); + await gitHost.addDeployKey(publicKey, repo.fullName); + } on GitHostException catch (e) { + print("GitHostSetupAutoConfigure: " + e.toString()); + setState(() { + errorMessage = widget.gitHostType.toString() + ": " + e.toString(); + }); + } widget.onDone(repo.cloneUrl); }); gitHost.launchOAuthScreen(); } on GitHostException catch (e) { - print("GitHostSetupAutoConfigur: " + e.toString()); + print("GitHostSetupAutoConfigure: " + e.toString()); setState(() { errorMessage = widget.gitHostType.toString() + ": " + e.toString(); });