Handle connection errors properly
This commit is contained in:
parent
4b350dddea
commit
f87fe502a6
1 changed files with 4 additions and 3 deletions
|
@ -77,6 +77,7 @@ func NewAccountView(
|
||||||
|
|
||||||
worker.PostAction(&types.Configure{Config: conf}, nil)
|
worker.PostAction(&types.Configure{Config: conf}, nil)
|
||||||
worker.PostAction(&types.Connect{}, acct.connected)
|
worker.PostAction(&types.Connect{}, acct.connected)
|
||||||
|
statusline.Set("Connecting...")
|
||||||
|
|
||||||
return acct
|
return acct
|
||||||
}
|
}
|
||||||
|
@ -145,9 +146,9 @@ func (acct *AccountView) connected(msg types.WorkerMessage) {
|
||||||
Message: types.RespondTo(msg),
|
Message: types.RespondTo(msg),
|
||||||
Approved: true,
|
Approved: true,
|
||||||
}, acct.connected)
|
}, acct.connected)
|
||||||
default:
|
case *types.Error:
|
||||||
acct.logger.Println("Connection failed.")
|
acct.logger.Printf("%v", msg.Error)
|
||||||
acct.statusline.Set("Connection failed.").
|
acct.statusline.Set(fmt.Sprintf("%v", msg.Error)).
|
||||||
Color(tcell.ColorRed, tcell.ColorDefault)
|
Color(tcell.ColorRed, tcell.ColorDefault)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue