zombienet_orchestrator/
errors.rs1use provider::ProviderError;
4use support::fs::FileSystemError;
5
6use crate::generators;
7
8#[derive(Debug, thiserror::Error)]
9pub enum OrchestratorError {
10 #[error("Invalid network configuration: {0}")]
12 InvalidConfig(String),
13 #[error("Invalid network config to use provider {0}: {1}")]
14 InvalidConfigForProvider(String, String),
15 #[error("Invalid configuration for node: {0}, field: {1}")]
16 InvalidNodeConfig(String, String),
17 #[error("Invariant not fulfilled {0}")]
18 InvariantError(&'static str),
19 #[error("Global network spawn timeout: {0} secs")]
20 GlobalTimeOut(u32),
21 #[error("Custom process '{name}': {reason}")]
22 CustomProcessFailed { name: String, reason: String },
23 #[error("Generator error: {0}")]
24 GeneratorError(#[from] generators::errors::GeneratorError),
25 #[error("Provider error: {0}")]
26 ProviderError(#[from] ProviderError),
27 #[error("FileSystem error: {0}")]
28 FileSystemError(#[from] FileSystemError),
29 #[error("Serialization error: {0}")]
30 SerializationError(#[from] serde_json::Error),
31 #[error(transparent)]
32 SpawnerError(#[from] anyhow::Error),
33}
34
35pub fn merge_errs(errs: &[OrchestratorError]) -> OrchestratorError {
38 let errs_str = errs
39 .iter()
40 .map(|e| e.to_string())
41 .collect::<Vec<String>>()
42 .join("\n");
43 OrchestratorError::InvalidConfig(errs_str)
44}