more errors
This commit is contained in:
parent
df266f6194
commit
6631ad325f
1 changed files with 24 additions and 15 deletions
|
@ -66,21 +66,24 @@ const (
|
||||||
DirectionUpload = "upload" // to reflector
|
DirectionUpload = "upload" // to reflector
|
||||||
DirectionDownload = "download" // from reflector
|
DirectionDownload = "download" // from reflector
|
||||||
|
|
||||||
errConnReset = "conn_reset"
|
errConnReset = "conn_reset"
|
||||||
errReadConnReset = "read_conn_reset"
|
errReadConnReset = "read_conn_reset"
|
||||||
errWriteConnReset = "write_conn_reset"
|
errWriteConnReset = "write_conn_reset"
|
||||||
errReadConnTimedOut = "read_conn_timed_out"
|
errReadConnTimedOut = "read_conn_timed_out"
|
||||||
errWriteBrokenPipe = "write_broken_pipe"
|
errWriteConnTimedOut = "write_conn_timed_out"
|
||||||
errEPipe = "e_pipe"
|
errWriteBrokenPipe = "write_broken_pipe"
|
||||||
errETimedout = "e_timedout"
|
errEPipe = "e_pipe"
|
||||||
errIOTimeout = "io_timeout"
|
errETimedout = "e_timedout"
|
||||||
errUnexpectedEOF = "unexpected_eof"
|
errIOTimeout = "io_timeout"
|
||||||
errUnexpectedEOFStr = "unexpected_eof_str"
|
errUnexpectedEOF = "unexpected_eof"
|
||||||
errJSONSyntax = "json_syntax"
|
errUnexpectedEOFStr = "unexpected_eof_str"
|
||||||
errBlobTooBig = "blob_too_big"
|
errJSONSyntax = "json_syntax"
|
||||||
errDeadlineExceeded = "deadline_exceeded"
|
errBlobTooBig = "blob_too_big"
|
||||||
errHashMismatch = "hash_mismatch"
|
errDeadlineExceeded = "deadline_exceeded"
|
||||||
errOther = "other"
|
errHashMismatch = "hash_mismatch"
|
||||||
|
errZeroByteBlob = "zero_byte_blob"
|
||||||
|
errInvalidCharacter = "invalid_character"
|
||||||
|
errOther = "other"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -130,6 +133,8 @@ func TrackError(direction string, e error) (shouldLog bool) { // shouldLog is a
|
||||||
} else if strings.Contains(err.Error(), "read: connection timed out") { // the other side closed the connection using TCP reset
|
} else if strings.Contains(err.Error(), "read: connection timed out") { // the other side closed the connection using TCP reset
|
||||||
//log.Warnln("read conn timed out is not the same as ETIMEDOUT")
|
//log.Warnln("read conn timed out is not the same as ETIMEDOUT")
|
||||||
errType = errReadConnTimedOut
|
errType = errReadConnTimedOut
|
||||||
|
} else if strings.Contains(err.Error(), "write: connection timed out") {
|
||||||
|
errType = errWriteConnTimedOut
|
||||||
} else if errors.Is(e, io.ErrUnexpectedEOF) {
|
} else if errors.Is(e, io.ErrUnexpectedEOF) {
|
||||||
errType = errUnexpectedEOF
|
errType = errUnexpectedEOF
|
||||||
} else if strings.Contains(err.Error(), "unexpected EOF") { // tried to read from closed pipe or socket
|
} else if strings.Contains(err.Error(), "unexpected EOF") { // tried to read from closed pipe or socket
|
||||||
|
@ -146,6 +151,10 @@ func TrackError(direction string, e error) (shouldLog bool) { // shouldLog is a
|
||||||
errType = errBlobTooBig
|
errType = errBlobTooBig
|
||||||
} else if strings.Contains(err.Error(), "hash of received blob data does not match hash from send request") {
|
} else if strings.Contains(err.Error(), "hash of received blob data does not match hash from send request") {
|
||||||
errType = errHashMismatch
|
errType = errHashMismatch
|
||||||
|
} else if strings.Contains(err.Error(), "0-byte blob received") {
|
||||||
|
errType = errZeroByteBlob
|
||||||
|
} else if strings.Contains(err.Error(), "invalid character") {
|
||||||
|
errType = errInvalidCharacter
|
||||||
} 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