do not log checksum mismatch error, client received the error (#16246)

This commit is contained in:
Harshavardhana
2022-12-14 01:57:40 -08:00
committed by GitHub
parent 0159b56717
commit c73ea27ed7
2 changed files with 21 additions and 4 deletions

View File

@@ -17,7 +17,10 @@
package hash
import "fmt"
import (
"errors"
"fmt"
)
// SHA256Mismatch - when content sha256 does not match with what was sent from client.
type SHA256Mismatch struct {
@@ -58,3 +61,9 @@ type ChecksumMismatch struct {
func (e ChecksumMismatch) Error() string {
return "Bad checksum: Want " + e.Want + " does not match calculated " + e.Got
}
// IsChecksumMismatch matches if 'err' is hash.ChecksumMismatch
func IsChecksumMismatch(err error) bool {
var herr ChecksumMismatch
return errors.As(err, &herr)
}