track hash mismatches
This commit is contained in:
parent
b3b581c00e
commit
df266f6194
1 changed files with 6 additions and 3 deletions
|
@ -79,6 +79,7 @@ const (
|
||||||
errJSONSyntax = "json_syntax"
|
errJSONSyntax = "json_syntax"
|
||||||
errBlobTooBig = "blob_too_big"
|
errBlobTooBig = "blob_too_big"
|
||||||
errDeadlineExceeded = "deadline_exceeded"
|
errDeadlineExceeded = "deadline_exceeded"
|
||||||
|
errHashMismatch = "hash_mismatch"
|
||||||
errOther = "other"
|
errOther = "other"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -112,17 +113,17 @@ func TrackError(direction string, e error) (shouldLog bool) { // shouldLog is a
|
||||||
|
|
||||||
err := ee.Wrap(e, 0)
|
err := ee.Wrap(e, 0)
|
||||||
errType := errOther
|
errType := errOther
|
||||||
if strings.Contains(err.Error(), "i/o timeout") { // hit a read or write deadline
|
if strings.Contains(err.Error(), "i/o timeout") {
|
||||||
errType = errIOTimeout
|
errType = errIOTimeout
|
||||||
} else if errors.Is(e, syscall.ECONNRESET) {
|
} else if errors.Is(e, syscall.ECONNRESET) {
|
||||||
// Looks like we're getting this when direction == "download", but read_conn_reset when its "upload"
|
// Looks like we're getting this when direction == "download", but read_conn_reset and
|
||||||
|
// write_conn_reset when its "upload"
|
||||||
errType = errConnReset
|
errType = errConnReset
|
||||||
} else if errors.Is(e, context.DeadlineExceeded) {
|
} else if errors.Is(e, context.DeadlineExceeded) {
|
||||||
errType = errDeadlineExceeded
|
errType = errDeadlineExceeded
|
||||||
} else if strings.Contains(err.Error(), "read: connection reset by peer") { // the other side closed the connection using TCP reset
|
} else if strings.Contains(err.Error(), "read: connection reset by peer") { // the other side closed the connection using TCP reset
|
||||||
errType = errReadConnReset
|
errType = errReadConnReset
|
||||||
} else if strings.Contains(err.Error(), "write: connection reset by peer") { // the other side closed the connection using TCP reset
|
} else if strings.Contains(err.Error(), "write: connection reset by peer") { // the other side closed the connection using TCP reset
|
||||||
log.Warnln("write conn reset by peer is not the same as ECONNRESET")
|
|
||||||
errType = errWriteConnReset
|
errType = errWriteConnReset
|
||||||
} else if errors.Is(e, syscall.ETIMEDOUT) {
|
} else if errors.Is(e, syscall.ETIMEDOUT) {
|
||||||
errType = errETimedout
|
errType = errETimedout
|
||||||
|
@ -143,6 +144,8 @@ func TrackError(direction string, e error) (shouldLog bool) { // shouldLog is a
|
||||||
} else if strings.Contains(err.Error(), "blob must be at most") {
|
} else if strings.Contains(err.Error(), "blob must be at most") {
|
||||||
//log.Warnln("blob must be at most X bytes is not the same as ErrBlobTooBig")
|
//log.Warnln("blob must be at most X bytes is not the same as ErrBlobTooBig")
|
||||||
errType = errBlobTooBig
|
errType = errBlobTooBig
|
||||||
|
} else if strings.Contains(err.Error(), "hash of received blob data does not match hash from send request") {
|
||||||
|
errType = errHashMismatch
|
||||||
} else if _, ok := e.(*json.SyntaxError); ok {
|
} else if _, ok := e.(*json.SyntaxError); ok {
|
||||||
errType = errJSONSyntax
|
errType = errJSONSyntax
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue