Add a bunch of new logging

This commit is contained in:
Tulir Asokan
2019-01-21 23:55:16 +02:00
parent 79bd35964f
commit 9e170f3d04
9 changed files with 53 additions and 30 deletions

10
user.go
View File

@ -192,7 +192,10 @@ func (user *User) Login(roomID types.MatrixRoomID) {
return
}
bot.SendImage(roomID, string(code), resp.ContentURI)
_, err = bot.SendImage(roomID, string(code), resp.ContentURI)
if err != nil {
user.log.Errorln("Failed to send QR code to user:", err)
}
}()
session, err := user.Conn.Login(qrChan)
if err != nil {
@ -204,7 +207,10 @@ func (user *User) Login(roomID types.MatrixRoomID) {
user.JID = strings.Replace(user.Conn.Info.Wid, whatsappExt.OldUserSuffix, whatsappExt.NewUserSuffix, 1)
user.Session = &session
user.Update()
bot.SendNotice(roomID, "Successfully logged in. Now, you may ask for `import contacts`.")
_, err = bot.SendNotice(roomID, "Successfully logged in. Now, you may ask for `import contacts`.")
if err != nil {
user.log.Warnln("Failed to send login confirmation to user:", err)
}
}
func (user *User) HandleError(err error) {