1use std::io;
2use thiserror::Error;
3
4use daedalus_planner::Diagnostic;
5use daedalus_registry::diagnostics::RegistryError;
6use daedalus_runtime::executor::ExecuteError;
7
8#[derive(Debug, Error)]
16#[non_exhaustive]
17pub enum EngineError {
18 #[error("invalid configuration: {0}")]
19 Config(String),
20 #[error("I/O error at {path}: {source}")]
21 Io {
22 path: String,
23 #[source]
24 source: io::Error,
25 },
26 #[error("registry error: {0}")]
27 Registry(#[from] RegistryError),
28 #[error("planner diagnostics: {0:?}")]
29 Planner(Vec<Diagnostic>),
30 #[error("runtime failed: {0}")]
31 Runtime(#[from] ExecuteError),
32 #[error("bundle parse error at {path}: {error}")]
33 BundleParse { path: String, error: String },
34 #[cfg(feature = "gpu")]
35 #[error("gpu selection failed: {0}")]
36 Gpu(#[from] daedalus_gpu::GpuError),
37 #[error("feature '{0}' is disabled at compile time")]
38 FeatureDisabled(&'static str),
39}
40
41impl EngineError {
42 pub fn io(path: impl Into<String>, source: io::Error) -> Self {
44 EngineError::Io {
45 path: path.into(),
46 source,
47 }
48 }
49}