From f87fe502a6d252bac9da5f08fd2aa682a9fc2277 Mon Sep 17 00:00:00 2001
From: Drew DeVault <sir@cmpwn.com>
Date: Sun, 13 Jan 2019 19:41:21 -0500
Subject: Handle connection errors properly

---
 widgets/account.go | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'widgets')

diff --git a/widgets/account.go b/widgets/account.go
index d99a21f..4411094 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -77,6 +77,7 @@ func NewAccountView(
 
 	worker.PostAction(&types.Configure{Config: conf}, nil)
 	worker.PostAction(&types.Connect{}, acct.connected)
+	statusline.Set("Connecting...")
 
 	return acct
 }
@@ -145,9 +146,9 @@ func (acct *AccountView) connected(msg types.WorkerMessage) {
 			Message:  types.RespondTo(msg),
 			Approved: true,
 		}, acct.connected)
-	default:
-		acct.logger.Println("Connection failed.")
-		acct.statusline.Set("Connection failed.").
+	case *types.Error:
+		acct.logger.Printf("%v", msg.Error)
+		acct.statusline.Set(fmt.Sprintf("%v", msg.Error)).
 			Color(tcell.ColorRed, tcell.ColorDefault)
 	}
 }
-- 
cgit 1.4.1-2-gfad0