mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-20 23:46:23 +01:00
16 lines
368 B
Go
16 lines
368 B
Go
|
package netutil
|
||
|
|
||
|
import (
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
// IsTrivialNetworkError returns true if the err can be ignored during logging.
|
||
|
func IsTrivialNetworkError(err error) bool {
|
||
|
// Suppress trivial network errors, which could occur at remote side.
|
||
|
s := err.Error()
|
||
|
if strings.Contains(s, "broken pipe") || strings.Contains(s, "reset by peer") {
|
||
|
return true
|
||
|
}
|
||
|
return false
|
||
|
}
|