mirror of
https://github.com/makayabou/asg-server.git
synced 2026-05-02 17:43:36 +02:00
log when unvalid textmessage
This commit is contained in:
parent
019228b7f2
commit
c0cd45f984
@ -75,7 +75,12 @@ func (m *Message) GetTextContent() (*TextMessageContent, error) {
|
|||||||
|
|
||||||
err := json.Unmarshal([]byte(m.Content), &content)
|
err := json.Unmarshal([]byte(m.Content), &content)
|
||||||
if err != nil {
|
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
|
return &content, nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user