Skip to main content

qubit_retry/error/
retry_error_reason.rs

1/*******************************************************************************
2 *
3 *    Copyright (c) 2025 - 2026 Haixing Hu.
4 *
5 *    SPDX-License-Identifier: Apache-2.0
6 *
7 *    Licensed under the Apache License, Version 2.0.
8 *
9 ******************************************************************************/
10//! Terminal retry-flow error reasons.
11
12use serde::{
13    Deserialize,
14    Serialize,
15};
16
17/// Reason why the whole retry flow stopped with an error.
18#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
19pub enum RetryErrorReason {
20    /// A listener or retry policy aborted the retry flow.
21    Aborted,
22    /// No attempts remain.
23    AttemptsExceeded,
24    /// The cumulative user operation elapsed-time budget was exhausted.
25    MaxOperationElapsedExceeded,
26    /// The total monotonic retry-flow elapsed-time budget was exhausted.
27    MaxTotalElapsedExceeded,
28    /// The operation mode does not support the configured behavior.
29    ///
30    /// Currently used when [`Retry::run`](crate::Retry::run) receives
31    /// configured per-attempt timeout options.
32    UnsupportedOperation,
33    /// A timed-out blocking worker did not exit within the cancellation grace period.
34    WorkerStillRunning,
35}