Add undeclared errors from peer.go to metrics #63

Merged
shyba merged 4 commits from declare_err into master 2022-10-17 19:01:56 +02:00
Showing only changes of commit 7f75602841 - Show all commits

View file

@ -90,6 +90,7 @@ const (
errInvalidPeerData = "invalid_peer_data"
errDeadlineExceeded = "deadline_exceeded"
errHashMismatch = "hash_mismatch"
errProtectedBlob = "protected_blob"
errZeroByteBlob = "zero_byte_blob"
errInvalidCharacter = "invalid_character"
errBlobNotFound = "blob_not_found"
@ -306,6 +307,8 @@ func TrackError(direction string, e error) (shouldLog bool) { // shouldLog is a
errType = errHashMismatch
} else if strings.Contains(err.Error(), "blob not found") {
errType = errBlobNotFound
} else if strings.Contains(err.Error(), "requested blob is protected") {
errType = errProtectedBlob
} else if strings.Contains(err.Error(), "0-byte blob received") {
errType = errZeroByteBlob
} else if strings.Contains(err.Error(), "PROTOCOL_VIOLATION: tried to retire connection") {