#[non_exhaustive]pub enum Error {
Parse(ParseError),
Config(ConfigError),
Spec(SpecError),
Io(Error),
IoAt {
path: PathBuf,
source: Error,
},
Formatter(String),
LayoutTooWide {
line_no: usize,
width: usize,
limit: usize,
},
}Expand description
Errors that can be returned by parsing, config loading, spec loading, or formatting operations.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Parse(ParseError)
A parser error annotated with source text and line-offset context.
Config(ConfigError)
A user config parse error.
Spec(SpecError)
A built-in or user override spec parse error.
Io(Error)
A filesystem or stream I/O failure where no path is attached.
Use Error::io_at (or the IoResultExt::with_path adapter)
when reporting an error against a specific file — the
path-bearing variant is far more useful in user-facing
diagnostics.
IoAt
A filesystem I/O failure annotated with the path that caused
it. Used at every site where we have a path in scope; far more
actionable than a bare permission denied from Error::Io.
Formatter(String)
A higher-level formatter or CLI error that does not fit another
structured variant. In practice this covers: runtime regex
validation failures on a programmatically-built crate::Config
(before the config is saved to disk), CLI argument validation
failures, and rendering failures in the config/spec pretty-printers.
LayoutTooWide
A formatted line exceeded the configured line width and
require_valid_layout is enabled.
Implementations§
Source§impl Error
impl Error
Sourcepub fn with_display_name(self, display_name: impl Into<String>) -> Self
pub fn with_display_name(self, display_name: impl Into<String>) -> Self
Attach a human-facing source name (e.g. a file path) to a
contextual ParseError. No-op for any other variant —
Config, Spec, Io, IoAt, Formatter, and
LayoutTooWide already carry the context they need and are
returned unchanged.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()