use std::io;
use std::path::PathBuf;
use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum ConfigurationError {
#[error("failed to read project configuration file `{path}`")]
ReadConfigurationFile {
path: PathBuf,
#[source]
source: io::Error,
},
#[error("failed to parse project configuration file `{path}`")]
ParseConfigurationFile {
path: PathBuf,
#[source]
source: serde_json::Error,
},
#[error("invalid project configuration in `{path}`: {reason}")]
InvalidConfigurationDocument {
path: PathBuf,
reason: String,
},
#[error("project configuration file `{path}` repeats key `{key}`")]
DuplicateConfigurationKey {
path: PathBuf,
key: String,
},
#[error(
"parameter `{key}` appears in both fixed configuration `{fixed_path}` and sweep configuration `{sweep_path}`"
)]
FixedSweepKeyConflict {
key: String,
fixed_path: PathBuf,
sweep_path: PathBuf,
},
#[error("parameter sweep task count overflows u64 while adding axis `{axis}`")]
TaskCountOverflow {
axis: String,
},
#[error(
"task index {index} is out of bounds for a parameter space containing {task_count} tasks"
)]
TaskIndexOutOfBounds {
index: u64,
task_count: u64,
},
#[error("task {task_index} does not contain parameter `{key}`")]
UnknownTaskParameter {
task_index: u64,
key: String,
},
#[error("failed to decode parameter `{key}` from task {task_index}")]
DecodeTaskParameter {
task_index: u64,
key: String,
#[source]
source: serde_json::Error,
},
#[error("failed to serialize resolved parameters for task {task_index}")]
SerializeTaskParameters {
task_index: u64,
#[source]
source: serde_json::Error,
},
#[error("project paths do not contain key `{key}`")]
UnknownProjectPath {
key: String,
},
#[error("failed to write project configuration file `{path}`")]
WriteConfigurationFile {
path: PathBuf,
#[source]
source: io::Error,
},
}