Classifiers¶
Retries are only safe when they respect protocol/domain semantics.
Classifiers implement:
The executor records Outcome on every attempt, and uses it to decide whether to retry, stop, or abort immediately.
Built-ins¶
Core built-ins include:
-
classify.AutoClassifier(default): Dispatches toHTTPClassifierwhen the error implementsHTTPError, otherwise usesAlwaysRetryOnError. This works automatically withrecourse/integrations/http, which returns errors implementingHTTPError. -
classify.ClassifierHTTP("http"): HTTP-aware decisions with idempotent-method rules; retries idempotent transport errors, 5xx, 408/429 (and configured extra 4xx), and honorsRetry-Afterfor backoff override. -
integrations/grpc.Classifier: gRPC status-code aware decisions (non-gRPC errors delegate toAutoClassifier).
Select a classifier by name via policy.RetryPolicy.ClassifierName.
Safety: type mismatches¶
If a classifier expects a specific value/error shape and receives something else, it should fail loudly and safely (e.g., non-retryable with a clear reason), not “retry blindly”.