Skip to main content

rusty_sponge/
error.rs

1//! Library-level error type for `rusty_sponge`.
2//!
3//! The library uses `thiserror` to produce typed errors per AD-009; the binary
4//! boundary wraps these in `anyhow::Result` for human-readable diagnostics.
5
6use std::path::PathBuf;
7
8/// Errors returned by the `rusty_sponge` library API.
9///
10/// Marked `#[non_exhaustive]` so future variant additions are not breaking
11/// changes within a major version.
12#[non_exhaustive]
13#[derive(thiserror::Error, Debug)]
14pub enum Error {
15    #[error("target is a directory: {0}")]
16    TargetIsDirectory(PathBuf),
17
18    #[error("invalid builder configuration: {0}")]
19    InvalidBuilderConfiguration(&'static str),
20
21    #[error("invalid spill threshold: {0}")]
22    SpillThresholdInvalid(String),
23
24    #[error("compatibility violation: {0}")]
25    CompatibilityViolation(&'static str),
26
27    #[error("IO error: {0}")]
28    Io(#[from] std::io::Error),
29}