Skip to main content

Crate santh_error

Crate santh_error 

Source
Expand description

santh-error - the shared error type for the Santh ecosystem.

The single rule: every error has a Fix: hint. No bare “parse error”. No “something went wrong”. Every error tells the user what to do.

§Quick start

use santh_error::SanthError;

let err = SanthError::new("CFG-E001", "config file not found")
    .fix("Fix: create config.toml or pass --config")
    .build();
assert!(err.actionable_message().contains("Fix:"));

§Safe-defaults answers

  • Input size: operates only on in-memory strings supplied by the caller; it opens no files and imposes no size cap of its own, so memory use tracks the caller’s message length.
  • Recursion depth: error source chains are walked iteratively, never recursively, so a deep source() chain cannot overflow the stack.
  • Outbound network: none. The crate performs no network access.
  • Process spawning: none. The crate spawns no child processes.
  • Filesystem writes: none. The crate reads and writes no files.
  • Credential exposure: every rendered message is passed through redact_secrets, so tokens, JWTs, and private keys are masked as [REDACTED] before they reach a log, error string, or temp file.

Structs§

ErrorLocation
Location in source or configuration where an error occurred.
HasFix
Marker type indicating the builder has received a fix hint.
NoFix
Marker type indicating the builder has not yet received a fix hint.
SanthError
The shared error type for the Santh ecosystem.
SanthErrorBuilder
Builder for SanthError.

Traits§

SanthErrorContract
The Santh error contract: every Santh error answers the same questions - which error it is (error_code), how to fix it (fix_hint, always starting with "Fix: "), and what failed (title via Display) - plus optional context and location.

Functions§

redact_secrets
Strip known-sensitive patterns from the input string.