diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-04-30 22:35:52 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-04-30 22:37:08 +0300 |
commit | 9ad3a95ba6cf1375745186d14e17b365205dc587 (patch) | |
tree | ea41bb6e0c6990d751257e9ab7d928cdbd54b9e1 | |
parent | b3543e90902e51c6f3cb3a90a7637d06a6ac5458 (diff) |
Re-render UI after printing message send error
-rw-r--r-- | ui/view-main.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ui/view-main.go b/ui/view-main.go index 8d6941f..c5f1304 100644 --- a/ui/view-main.go +++ b/ui/view-main.go @@ -122,7 +122,14 @@ func (view *MainView) sendTempMessage(roomView *RoomView, tempMessage ifc.Messag eventID, err := view.matrix.SendMarkdownMessage(roomView.Room.ID, tempMessage.Type(), text) if err != nil { 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)) + view.parent.Render() } else { roomView.MessageView().UpdateMessageID(tempMessage, eventID) } |