ff_core/error.rs
1//! Error classification for FlowFabric.
2//!
3//! `ErrorClass` lives here so `ff-core` stays a pure types/contracts crate.
4//! The `ScriptError` enum and its `ferriskey::Error` transport variant live
5//! in `ff-script::error` to keep `ff-core` free of the Valkey client stack.
6
7use serde::{Deserialize, Serialize};
8
9/// Classification of how the SDK should handle each error.
10#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
11#[serde(rename_all = "snake_case")]
12pub enum ErrorClass {
13 /// Stop work. Do NOT retry.
14 Terminal,
15 /// Retry after backoff.
16 Retryable,
17 /// Take specific action then stop.
18 Cooperative,
19 /// No-op, log and continue.
20 Informational,
21 /// Log warning only.
22 Advisory,
23 /// Should never happen — alert.
24 Bug,
25 /// Normal empty state.
26 Expected,
27 /// Log warning, may continue.
28 SoftError,
29}