mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Signed-off-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <wpfleger@block.xyz> Signed-off-by: Will Pfleger <wpfleger@squareup.com> Signed-off-by: Will Pfleger <wpfleger96@gmail.com> Co-authored-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1fgdl5qqnh3k3f2xkqrvt7cujalhm623x4s7fdjdj5yrtp5fzjl9qrjpucw <4a1bfa0013bc6d14a8d600d8bf6392efefbd2a26ac3c96c9b2a106b0d12297ca@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub16v54tttfqacx9ycvc3k0ut0npj564ahcuajzy6qjvh57ntmsf4uq4806j2 <d32955ad69077062930cc46cfe2df30ca9aaf6f8e76422681265e9e9af704d78@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Will Pfleger <wpfleger96@gmail.com>
67 lines
2.0 KiB
Rust
67 lines
2.0 KiB
Rust
//! Workflow error types.
|
|
|
|
use thiserror::Error;
|
|
|
|
/// Partial execution progress captured when a workflow step fails mid-run.
|
|
///
|
|
/// This allows callers to persist whatever trace was accumulated before the
|
|
/// error, rather than losing it when the in-memory `Vec` is dropped.
|
|
#[derive(Debug, Default)]
|
|
pub struct PartialProgress {
|
|
/// Index of the step that failed (0-based).
|
|
pub step_index: usize,
|
|
/// Trace entries for steps completed/skipped before the failure.
|
|
pub trace: Vec<serde_json::Value>,
|
|
}
|
|
|
|
/// Errors produced by the workflow engine.
|
|
#[derive(Debug, Error)]
|
|
pub enum WorkflowError {
|
|
/// The workflow YAML/JSON could not be parsed.
|
|
#[error("invalid YAML: {0}")]
|
|
InvalidYaml(#[from] serde_yaml::Error),
|
|
|
|
/// The workflow definition violates a semantic invariant.
|
|
#[error("invalid definition: {0}")]
|
|
InvalidDefinition(String),
|
|
|
|
/// An `if:` condition expression could not be evaluated.
|
|
#[error("condition evaluation error: {0}")]
|
|
ConditionError(String),
|
|
|
|
/// A template variable substitution failed.
|
|
#[error("template error: {0}")]
|
|
TemplateError(String),
|
|
|
|
/// A step exceeded its configured timeout.
|
|
#[error("step '{step_id}' timed out after {timeout_secs}s")]
|
|
StepTimeout {
|
|
/// The ID of the step that timed out.
|
|
step_id: String,
|
|
/// The timeout limit in seconds.
|
|
timeout_secs: u64,
|
|
},
|
|
|
|
/// An outbound webhook call failed.
|
|
#[error("webhook error: {0}")]
|
|
WebhookError(String),
|
|
|
|
/// The engine's concurrency limit was reached.
|
|
#[error("capacity exceeded")]
|
|
CapacityExceeded,
|
|
|
|
/// A database operation failed.
|
|
#[error("database error: {0}")]
|
|
Database(String),
|
|
|
|
/// The action is defined but not yet implemented.
|
|
#[error("action not implemented: {0}")]
|
|
NotImplemented(String),
|
|
}
|
|
|
|
impl From<buzz_db::error::DbError> for WorkflowError {
|
|
fn from(e: buzz_db::error::DbError) -> Self {
|
|
WorkflowError::Database(e.to_string())
|
|
}
|
|
}
|