Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AttemptedTLSWithNonTLSBackend = ClassifierFunc(func(err error) bool { return errors.As(err, &tls.RecordHeaderError{}) })
View Source
var ConnectionResetOnRead = ClassifierFunc(func(err error) bool { var opErr *net.OpError if errors.As(err, &opErr) { return opErr.Err.Error() == "read: connection reset by peer" } return false })
View Source
var ContextCancelled = ClassifierFunc(func(err error) bool { return errors.Is(err, context.Canceled) })
View Source
var Dial = ClassifierFunc(func(err error) bool { var opErr *net.OpError if errors.As(err, &opErr) { return opErr.Op == "dial" } return false })
View Source
var ExpiredOrNotYetValidCertFailure = ClassifierFunc(func(err error) bool { var certErr x509.CertificateInvalidError if errors.As(err, &certErr) { return certErr.Reason == x509.Expired } return false })
View Source
var FailableClassifiers = ClassifierGroup{ Dial, AttemptedTLSWithNonTLSBackend, HostnameMismatch, RemoteFailedCertCheck, RemoteHandshakeFailure, RemoteHandshakeTimeout, UntrustedCert, ExpiredOrNotYetValidCertFailure, ConnectionResetOnRead, }
View Source
var HostnameMismatch = ClassifierFunc(func(err error) bool { return errors.As(err, &x509.HostnameError{}) })
View Source
var IdempotentRequestEOF = ClassifierFunc(func(err error) bool { return errors.Is(err, IdempotentRequestEOFError) })
View Source
var IdempotentRequestEOFError = errors.New("EOF (via idempotent request)")
View Source
var IncompleteRequest = ClassifierFunc(func(err error) bool { return errors.Is(err, IncompleteRequestError) })
View Source
var IncompleteRequestError = errors.New("incomplete request")
View Source
var PrunableClassifiers = ClassifierGroup{ Dial, AttemptedTLSWithNonTLSBackend, HostnameMismatch, RemoteFailedCertCheck, RemoteHandshakeFailure, RemoteHandshakeTimeout, UntrustedCert, ExpiredOrNotYetValidCertFailure, }
View Source
var RemoteFailedCertCheck = ClassifierFunc(func(err error) bool { var opErr *net.OpError if errors.As(err, &opErr) { if opErr.Op == "remote error" { if opErr.Err.Error() == "tls: bad certificate" || opErr.Err.Error() == "tls: unknown certificate authority" || opErr.Err.Error() == "tls: certificate required" { return true } } } return false })
View Source
var RemoteHandshakeFailure = ClassifierFunc(func(err error) bool { var opErr *net.OpError if errors.As(err, &opErr) { return opErr != nil && opErr.Error() == "remote error: tls: handshake failure" } return false })
View Source
var RemoteHandshakeTimeout = ClassifierFunc(func(err error) bool { return err != nil && strings.Contains(err.Error(), "net/http: TLS handshake timeout") })
View Source
var RetriableClassifiers = ClassifierGroup{ Dial, AttemptedTLSWithNonTLSBackend, HostnameMismatch, RemoteFailedCertCheck, RemoteHandshakeFailure, RemoteHandshakeTimeout, UntrustedCert, ExpiredOrNotYetValidCertFailure, IdempotentRequestEOF, IncompleteRequest, }
RetriableClassifiers include backend errors that are safe to retry
Backend errors are only safe to retry if we can be certain that they have occurred before any http request data has been sent from gorouter to the backend application.
Otherwise, there’s risk of a mutating non-idempotent request (e.g. send payment) being silently retried without the client knowing.
View Source
var UntrustedCert = ClassifierFunc(func(err error) bool { var tlsCertError *tls.CertificateVerificationError switch { case errors.As(err, &x509.UnknownAuthorityError{}), errors.As(err, &tlsCertError): return true default: return false } })
Functions ¶
This section is empty.
Types ¶
type Classifier ¶
type ClassifierFunc ¶
func (ClassifierFunc) Classify ¶
func (f ClassifierFunc) Classify(err error) bool
type ClassifierGroup ¶
type ClassifierGroup []Classifier
func (ClassifierGroup) Classify ¶
func (cg ClassifierGroup) Classify(err error) bool
Classify returns true on errors that are retryable
Click to show internal directories.
Click to hide internal directories.