Skip to main content

sbe_core/
error.rs

1use std::path::PathBuf;
2
3/// Errors that can occur in sbe-core.
4#[derive(Debug, thiserror::Error)]
5pub enum CoreError {
6    /// Failed to determine the user's home directory.
7    #[error("could not determine home directory")]
8    NoHomeDir,
9
10    /// Failed to read or parse a configuration file.
11    #[error("failed to load config from {path}: {source}")]
12    ConfigLoad {
13        path: PathBuf,
14        source: Box<dyn std::error::Error + Send + Sync>,
15    },
16
17    /// An extended profile references a base that does not exist.
18    #[error("profile '{child}' extends unknown profile '{base}'")]
19    UnknownBaseProfile { child: String, base: String },
20
21    /// No ecosystem could be detected and no --profile was given.
22    #[error(
23        "could not detect ecosystem from command '{command}' or working directory; use --profile"
24    )]
25    DetectionFailed { command: String },
26}