summary refs log tree commit diff stats
path: root/widgets/account.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-01-13 19:41:21 -0500
committerDrew DeVault <sir@cmpwn.com>2019-01-13 19:41:21 -0500
commitf87fe502a6d252bac9da5f08fd2aa682a9fc2277 (patch)
treeb9f2d5b8ddd077e93e82e70c95d968a2f42852e1 /widgets/account.go
parent4b350dddea99faad7450f292b6be036a0fe3220d (diff)
downloadaerc-f87fe502a6d252bac9da5f08fd2aa682a9fc2277.tar.gz
Handle connection errors properly
Diffstat (limited to 'widgets/account.go')
-rw-r--r--widgets/account.go7
1 files changed, 4 insertions, 3 deletions
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)
 	}
 }