1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Typed internal errors for the crate root.
//!
//! These errors are converted at the crate boundary into stable diagnostics
//! (exit codes, `ValidationIssue` paths). They use `thiserror` for ergonomic
//! `Display` impls without panics on user input.
use thiserror::Error;
/// Errors that can arise while loading or validating recipes and config.
#[derive(Debug, Error)]
pub enum CoreError {
/// I/O failure while reading a file.
#[error("I/O error reading {path}: {source}")]
Io {
/// File path that failed to read.
path: String,
/// Underlying I/O error.
source: std::io::Error,
},
/// Parse failure for JSON or YAML inputs.
#[error("parse error at {path}: {message}")]
Parse {
/// File path or logical source.
path: String,
/// Human-readable parse message.
message: String,
},
/// Validation failure with structured issues (not a single error string).
#[error("validation failed with {count} error(s)")]
Validation {
/// Number of error-severity issues.
count: usize,
},
/// Config value failed semantic checks (e.g. non-finite idle cap).
#[error("invalid config value for {field}: {message}")]
InvalidConfig {
/// Field name.
field: String,
/// Reason.
message: String,
},
}