fails

package
v0.0.0-...-c13e492 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2022 License: Apache-2.0, BSD-2-Clause-Views, BSD-3-Clause, + 1 more Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AttemptedTLSWithNonTLSBackend = ClassifierFunc(func(err error) bool {
	switch err.(type) {
	case tls.RecordHeaderError, *tls.RecordHeaderError:
		return true
	default:
		return false
	}
})
View Source
var ConnectionResetOnRead = ClassifierFunc(func(err error) bool {
	ne, ok := err.(*net.OpError)
	return ok && ne.Op == "read" && ne.Err.Error() == "read: connection reset by peer"
})
View Source
var ContextCancelled = ClassifierFunc(func(err error) bool {
	return err == context.Canceled
})
View Source
var Dial = ClassifierFunc(func(err error) bool {
	ne, ok := err.(*net.OpError)
	return ok && ne.Op == "dial"
})
View Source
var ExpiredOrNotYetValidCertFailure = ClassifierFunc(func(err error) bool {
	switch x509err := err.(type) {
	case x509.CertificateInvalidError:
		return x509err.Reason == x509.Expired
	case *x509.CertificateInvalidError:
		return x509err.Reason == x509.Expired
	default:
		return false
	}
})
View Source
var HostnameMismatch = ClassifierFunc(func(err error) bool {
	switch err.(type) {
	case x509.HostnameError, *x509.HostnameError:
		return true
	default:
		return false
	}
})
View Source
var IdempotentRequestEOF = ClassifierFunc(func(err error) bool {
	return err == IdempotentRequestEOFError
})
View Source
var IdempotentRequestEOFError = errors.New("EOF (via idempotent request)")
View Source
var PrunableClassifiers = RetriableClassifiers
View Source
var RemoteFailedCertCheck = ClassifierFunc(func(err error) bool {
	return err != nil && (err.Error() == "readLoopPeekFailLocked: remote error: tls: bad certificate" || err.Error() == "remote error: tls: bad certificate")
})
View Source
var RemoteHandshakeFailure = ClassifierFunc(func(err error) bool {
	return err != nil && err.Error() == "remote error: tls: handshake failure"
})
View Source
var RemoteHandshakeTimeout = ClassifierFunc(func(err error) bool {
	return err != nil && err.Error() == "net/http: TLS handshake timeout"
})

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 {
	switch err.(type) {
	case x509.UnknownAuthorityError, *x509.UnknownAuthorityError:
		return true
	default:
		return false
	}
})

Functions

This section is empty.

Types

type Classifier

type Classifier interface {
	Classify(err error) bool
}

type ClassifierFunc

type ClassifierFunc func(err error) bool

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

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL