error-forge 1.0.0

Pragmatic Rust error-handling framework with stable error metadata, contextual diagnostics, optional async support, and synchronous recovery primitives (retry, circuit-breaker, backoff). Optional #[derive(ModError)], declarative define_errors!, and feature-gated logging / tracing / serde adapters.
Documentation
[package]
name = "error-forge"
# 1.0.0 (2026-05-18) — stable API. Public surface frozen under
# SemVer for the entire 1.x line. See docs/STABILITY.md for the
# binding contract and docs/API-FREEZE-AUDIT.md for the surface
# manifest. Major changes vs 0.9.x: `group!` macro rewritten
# (requires `: ForgeError` on wrapped types), `CircuitBreaker`
# switched to `parking_lot::Mutex` (no poisoning), hook callback
# widened to `Box<dyn Fn>`, `#[non_exhaustive]` on several
# public types, `Result<T>` deprecated in favour of `AppResult<T>`,
# `register_error_hook` (non-try) deprecated, `rand` gated behind
# new `jitter` feature.
version = "1.0.0"
edition = "2021"
# MSRV. The crate uses `io::Error::other` (stabilised 1.74),
# `Mutex::new()` in const context (1.63 — fine), and Cargo lockfile
# format v4 (default since 1.78, can't be parsed by older
# toolchains). `1.81` is also the floor required by clippy's
# `incompatible_msrv` lint on the current source, and matches
# `mod-events` in this workspace for consistency. CI verifies on
# 1.81.0 in a dedicated MSRV job.
rust-version = "1.81"
readme = "README.md"
license = "Apache-2.0"

authors = [
    "James Gober <me@jamesgober.com>"
]

description = "Pragmatic Rust error-handling framework with stable error metadata, contextual diagnostics, optional async support, and synchronous recovery primitives (retry, circuit-breaker, backoff). Optional #[derive(ModError)], declarative define_errors!, and feature-gated logging / tracing / serde adapters."

keywords = [
    "error",
    "error-handling",
    "async",
    "resilience",
    "circuit-breaker"
]

categories = [
    "rust-patterns",
    "development-tools::debugging",
    "asynchronous",
    "development-tools"
]

documentation = "https://docs.rs/error-forge"
repository = "https://github.com/jamesgober/error-forge"
homepage = "https://github.com/jamesgober/error-forge"

# Configuration for docs.rs
[package.metadata.docs.rs]
# Enable all features when building docs
all-features = true
# Enable specific features for documentation
features = ["derive", "serde", "console", "backtrace"]
# Set specific rustdoc flags
rustdoc-args = ["--cfg", "docsrs"]


[dependencies]
thiserror = "1.0"
# `pastey` is a drop-in fork of `paste`. The original `paste` crate
# was archived by its author on 2024-10-07 (RUSTSEC-2024-0436,
# "unmaintained"); `pastey` keeps the public `paste!` macro API and
# behaviour, with the same `[<...>]` token-pasting and case-modifier
# syntax `define_errors!` relies on.
pastey = "0.2"
# `parking_lot` provides a non-poisoning `Mutex` used by
# `CircuitBreaker`'s internal state. The standard `std::sync::Mutex`
# poisons on panic, which is incompatible with this crate's
# error-handling premise; `parking_lot::Mutex` returns the guard
# directly with no `Result` to unwrap.
parking_lot = "0.12"
error-forge-derive = {version = "1.0.0", path = "./error-forge-derive", optional = true }
serde = { version = "1.0", optional = true, features = ["derive"] }
log = { version = "0.4", optional = true }
tracing = { version = "0.1", optional = true }
async-trait = { version = "0.1.74", optional = true }
# `rand` is only used to add ±20% jitter to `ExponentialBackoff` when
# the caller opts in. Gated behind the `jitter` feature so users who
# never call `ExponentialBackoff::with_jitter(true)` don't pay for
# `rand`'s transitive deps (`getrandom`, `rand_core`, `rand_chacha`,
# `ppv-lite86`).
rand = { version = "0.8.5", optional = true }

[features]
default = []
derive = ["error-forge-derive"]
serde = ["dep:serde"]
console = []
backtrace = []
# Enables ±20% jitter in `recovery::ExponentialBackoff::with_jitter`.
# Pulls in `rand` for non-cryptographic random delays. Off by
# default — backoff still works without it, jitter is a no-op.
jitter = ["dep:rand"]
log = ["dep:log"]
tracing = ["dep:tracing"]
registry = []
collector = []
context = []
async = ["dep:async-trait"]

[workspace]
members = ["error-forge-derive"]

[dev-dependencies]
serde_json = "1.0"
tokio = { version = "1.0", features = ["full", "test-util", "macros"] }