use std::path::PathBuf;
use std::time::Duration;
use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum RuntimeError {
#[error("workflow execution was cancelled by the user")]
ExecutionCancelled,
#[error("failed to create inferred output scope `{path}`")]
OutputScope {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("task `{task}` failed: {source}")]
Task {
task: String,
#[source]
source: Box<dyn std::error::Error + Send + Sync + 'static>,
},
#[error("task `{task}` panicked")]
TaskPanicked {
task: String,
},
#[error("task `{task}` exceeded its timeout of {timeout:?}")]
TaskTimedOut {
task: String,
timeout: Duration,
},
#[error("task `{task}` was cancelled")]
TaskCancelled {
task: String,
},
#[error("phase `{phase}` exceeded its timeout of {timeout:?}")]
PhaseTimedOut {
phase: String,
timeout: Duration,
},
#[error("failed to start runtime worker for `{scope}`")]
StartWorker {
scope: String,
#[source]
source: std::io::Error,
},
#[error("replicate {index} panicked")]
ReplicatePanicked {
index: u64,
},
#[error("replicate {index} failed: {source}")]
Replicate {
index: u64,
#[source]
source: Box<RuntimeError>,
},
}