Skip to main content

greentic_deployer/
error.rs

1use std::io;
2
3use serde_json;
4use thiserror::Error;
5
6use greentic_distributor_client::error::DistributorError;
7
8#[derive(Debug, Error)]
9pub enum DeployerError {
10    #[error("configuration error: {0}")]
11    Config(String),
12
13    #[error("pack parsing error: {0}")]
14    Pack(String),
15
16    #[error("deployer contract error: {0}")]
17    Contract(String),
18
19    #[error("IO error: {0}")]
20    Io(#[from] io::Error),
21
22    #[error("manifest decode error: {0}")]
23    ManifestDecode(#[from] greentic_types::cbor::CborError),
24
25    #[error("distributor error: {0}")]
26    Distributor(#[from] DistributorError),
27
28    #[error("JSON serialization error: {0}")]
29    Json(#[from] serde_json::Error),
30
31    #[error("telemetry initialization error: {0}")]
32    Telemetry(String),
33
34    #[error("secret backend error: {0}")]
35    Secret(String),
36
37    #[error(
38        "missing secrets for pack {pack_id} {pack_version}: {missing:?}. Remediate via: {hint}"
39    )]
40    MissingSecrets {
41        pack_id: String,
42        pack_version: String,
43        missing: Vec<String>,
44        hint: String,
45    },
46
47    #[error("offline mode incompatible with requested operation: {0}")]
48    OfflineDisallowed(String),
49
50    #[error(
51        "deployment packs not wired yet for capability={capability}, provider={provider}, strategy={strategy}"
52    )]
53    DeploymentPackUnsupported {
54        capability: String,
55        provider: String,
56        strategy: String,
57    },
58
59    #[error("unexpected error: {0}")]
60    Other(String),
61}
62
63pub type Result<T> = std::result::Result<T, DeployerError>;