Skip to main content

icydb_config_build/
error.rs

1use std::{io, path::PathBuf};
2
3use thiserror::Error as ThisError;
4
5/// Build-script config loading error with path-aware diagnostics.
6#[derive(Debug, ThisError)]
7pub enum ConfigBuildError {
8    #[error("failed to read IcyDB config at '{}': {source}", path.display())]
9    Read { path: PathBuf, source: io::Error },
10
11    #[error("failed to parse IcyDB config at '{}': {source}", path.display())]
12    Parse {
13        path: PathBuf,
14        source: toml::de::Error,
15    },
16
17    #[error("failed to resolve current directory for IcyDB config discovery: {source}")]
18    CurrentDir { source: io::Error },
19
20    #[error("IcyDB config at '{}' contains an empty canister name", path.display())]
21    EmptyCanisterName { path: PathBuf },
22
23    #[error(
24        "IcyDB config at '{}' has ambiguous canister names '{first}' and '{second}' after normalization",
25        path.display()
26    )]
27    AmbiguousCanisterName {
28        path: PathBuf,
29        first: String,
30        second: String,
31    },
32
33    #[error(
34        "IcyDB config at '{}' contains canister '{canister}' but the generated schema has no matching canister",
35        path.display()
36    )]
37    UnknownCanister { path: PathBuf, canister: String },
38
39    #[error(
40        "generated schema canister names '{first}' and '{second}' are ambiguous after normalization"
41    )]
42    AmbiguousKnownCanister { first: String, second: String },
43}