ErrorRecovery
Advanced pattern matching for error recovery and intelligent retry logic.
Uses Scala's powerful pattern matching to implement sophisticated error handling strategies with type-safe recovery patterns.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ErrorRecovery.type
Members list
Type members
Classlikes
Circuit breaker pattern for service resilience.
Circuit breaker pattern for service resilience.
Value parameters
- clock
-
the current time; injectable for tests
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait CircuitStateclass Objecttrait Matchableclass AnyShow all
- Self type
-
Closed.type
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait CircuitStateclass Objecttrait Matchableclass AnyShow all
- Self type
-
HalfOpen.type
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait CircuitStateclass Objecttrait Matchableclass AnyShow all
- Self type
-
Open.type
Value members
Concrete methods
Binary-compatible overload — delegates to the full version, sleeping the calling thread.
Binary-compatible overload — delegates to the full version, sleeping the calling thread.
Attributes
Retries operation while it fails with a transient error, up to maxAttempts calls in all.
Retries operation while it fails with a transient error, up to maxAttempts calls in all.
What is retried is the library's one rule for automatic retry, org.llm4s.reliability.RetryPolicy.isRetryable, which ReliableClient, LLMClientRetry and the agent graph's node retries use too: a RecoverableError, except a ServiceError or an APIError with a client-error status (any 4xx but 408 and 429) and an OptimisticLockFailure. Each retried error waits on its own schedule:
- RateLimitError: waits its RateLimitError.retryDelay, which is the provider's
retryAfterhint, else RateLimitError.DefaultRetryDelay (30 seconds).baseDelayis not used. - ServiceError with a 5xx, 429 or 408 status: waits the provider's
retryAfterhint, elsebaseDelay * nafter the n-th attempt (linear:baseDelay,2 * baseDelay, ...). Its ServiceError.retryDelay default is not used. - TimeoutError: waits
baseDelaybefore every retry. - Any other retried error (NetworkError, ExecutionError, SystemError, an APIError with no status or a 5xx, 429 or 408 one, or another module's RecoverableError, such as
llm4s-agent'sGraphError.ThreadBusy): waitsbaseDelay * nafter the n-th attempt, as an unhintedServiceErrordoes.
Every other error, including a CancelledError, is returned unchanged at once, whatever the attempt count. An interrupt during a wait returns a CancelledError. When the last attempt fails with a retried error, the result is an ExecutionError (itself a retried RecoverableError) whose message names the number of attempts made and the last error's message, and whose operation is the last error's formatted text. The operation is always called at least once, even when maxAttempts is below 1.
Value parameters
- sleepFn
-
pauses between attempts (default: sleeps the calling thread); override for testing