log when unvalid textmessage

This commit is contained in:
Florian du Garage Num 2025-09-19 12:29:59 +02:00
parent 019228b7f2
commit c0cd45f984

View File

@ -75,7 +75,12 @@ func (m *Message) GetTextContent() (*TextMessageContent, error) {
err := json.Unmarshal([]byte(m.Content), &content)
if err != nil {
return nil, fmt.Errorf("failed to unmarshal text content: %w", err)
log.Printf("[WARN] Invalid text content in message ID %d (ExtID=%s): %q (err=%v)",
m.ID, m.ExtID, m.Content, err)
return &TextMessageContent{
Text: fmt.Sprintf("[invalid content: %s]", m.Content),
}, nil
//return nil, fmt.Errorf("failed to unmarshal text content: %w", err)
}
return &content, nil