try to handle unknown parent events

This commit is contained in:
Aine
2023-08-22 14:41:52 +03:00
parent f9d05d94c9
commit 429645c3a9

View File

@@ -120,7 +120,10 @@ func (b *Bot) IncomingEmail(ctx context.Context, email *email.Email) error {
content := email.Content(threadID, cfg.ContentOptions())
eventID, serr := b.lp.Send(roomID, content)
if serr != nil {
return utils.UnwrapError(serr)
if !strings.Contains(serr.Error(), "M_UNKNOWN") { // if it's not an unknown event event error
return utils.UnwrapError(serr)
}
threadID = "" // unknown event edge case - remove existing thread ID to avoid complications
}
if threadID == "" {
threadID = eventID