Re-render UI after printing message send error
This commit is contained in:
parent
b3543e9090
commit
9ad3a95ba6
@ -122,7 +122,14 @@ func (view *MainView) sendTempMessage(roomView *RoomView, tempMessage ifc.Messag
|
|||||||
eventID, err := view.matrix.SendMarkdownMessage(roomView.Room.ID, tempMessage.Type(), text)
|
eventID, err := view.matrix.SendMarkdownMessage(roomView.Room.ID, tempMessage.Type(), text)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tempMessage.SetState(ifc.MessageStateFailed)
|
tempMessage.SetState(ifc.MessageStateFailed)
|
||||||
|
if httpErr, ok := err.(gomatrix.HTTPError); ok {
|
||||||
|
if respErr, ok := httpErr.WrappedError.(gomatrix.RespError); ok {
|
||||||
|
// Show shorter version if available
|
||||||
|
err = respErr
|
||||||
|
}
|
||||||
|
}
|
||||||
roomView.AddServiceMessage(fmt.Sprintf("Failed to send message: %v", err))
|
roomView.AddServiceMessage(fmt.Sprintf("Failed to send message: %v", err))
|
||||||
|
view.parent.Render()
|
||||||
} else {
|
} else {
|
||||||
roomView.MessageView().UpdateMessageID(tempMessage, eventID)
|
roomView.MessageView().UpdateMessageID(tempMessage, eventID)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user