Improve error handling and logging in message processing
- Updated HandleMessage function to include the actual message content in error notices for invalid messages, enhancing clarity for debugging. - Added nil check in Value method of tag encoder to prevent potential nil pointer dereference. - Refactored tag handling in spider to utilize hex-encoded pubkeys for improved compatibility and clarity in filter creation. - bump to v0.19.10
This commit is contained in:
@@ -75,9 +75,7 @@ func (l *Listener) HandleMessage(msg []byte, remote string) {
|
||||
// Validate message for invalid characters before processing
|
||||
if err := validateJSONMessage(msg); err != nil {
|
||||
log.E.F("%s message validation FAILED (len=%d): %v", remote, len(msg), err)
|
||||
// Don't log the actual message content as it contains binary data
|
||||
// Send generic error notice to client
|
||||
if noticeErr := noticeenvelope.NewFrom("invalid message format: contains invalid characters").Write(l); noticeErr != nil {
|
||||
if noticeErr := noticeenvelope.NewFrom(fmt.Sprintf("invalid message format: contains invalid characters: %s", msg)).Write(l); noticeErr != nil {
|
||||
log.E.F("%s failed to send validation error notice: %v", remote, noticeErr)
|
||||
}
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user