use troupekit_agent::AgentError;
use troupekit_core::error::CoreError;
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
#[error("{file}: {field}: {message}")]
pub struct WorkflowError {
pub file: String,
pub field: String,
pub message: String,
}
impl WorkflowError {
pub fn new(file: &str, field: &str, message: impl Into<String>) -> Self {
Self {
file: file.to_string(),
field: field.to_string(),
message: message.into(),
}
}
}
#[derive(Debug, Clone, PartialEq, thiserror::Error)]
pub enum GraphError {
#[error(transparent)]
Workflow(#[from] WorkflowError),
#[error("setup: {0}")]
Setup(String),
#[error("checkpoint: {0}")]
Checkpoint(String),
#[error("resume: {0}")]
Resume(String),
#[error(transparent)]
Agent(#[from] AgentError),
#[error(transparent)]
Store(#[from] CoreError),
}