diff options
-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) } |