1use std::path::PathBuf;
8use thiserror::Error;
9
10pub type Result<T> = std::result::Result<T, Error>;
11
12#[derive(Error, Debug)]
13pub enum Error {
14 #[error("Braze API error: {0}")]
15 Api(#[from] crate::braze::error::BrazeApiError),
16
17 #[error("Configuration error: {0}")]
18 Config(String),
19
20 #[error("Missing environment variable: {0}")]
21 MissingEnv(String),
22
23 #[error("I/O error: {0}")]
24 Io(#[from] std::io::Error),
25
26 #[error("YAML parse error in {path}: {source}")]
27 YamlParse {
28 path: PathBuf,
29 #[source]
30 source: serde_norway::Error,
31 },
32
33 #[error("CSV parse error in {path}: {source}")]
34 CsvParse {
35 path: PathBuf,
36 #[source]
37 source: csv::Error,
38 },
39
40 #[error("Invalid file format in {path}: {message}")]
41 InvalidFormat { path: PathBuf, message: String },
42
43 #[error("Drift detected in {count} resource(s)")]
44 DriftDetected { count: usize },
45
46 #[error("Destructive change blocked: pass --allow-destructive to proceed")]
47 DestructiveBlocked,
48
49 #[error("Rate limit exhausted after {retries} retries")]
50 RateLimitExhausted { retries: u32 },
51
52 #[error(
53 "Custom Attribute '{name}' cannot be created via API; created implicitly via /users/track"
54 )]
55 CustomAttributeCreateNotSupported { name: String },
56}