Skip to main content

orion_error/core/
cli.rs

1use super::{DomainReason, StructError};
2
3/// Print an error with its full source chain to stderr.
4///
5/// This is a convenience wrapper around [`StructError::display_chain()`]
6/// intended for binary/CLI entry points.
7///
8/// # Example
9///
10/// ```rust
11/// use orion_error::{cli::print_error, StructError, UnifiedReason};
12///
13/// let err = StructError::from(UnifiedReason::system_error())
14///     .with_detail("config not found");
15/// print_error(&err);
16/// ```
17pub fn print_error<R>(err: &StructError<R>)
18where
19    R: DomainReason,
20{
21    eprintln!("{}", err.display_chain());
22}