use troupekit_core::error::CoreError;
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
#[error("{file}: {field}: {message}")]
pub struct PersonaError {
pub file: String,
pub field: String,
pub message: String,
}
impl PersonaError {
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 AgentError {
#[error(transparent)]
Persona(#[from] PersonaError),
#[error("persona not found: {0}")]
NotFound(String),
#[error("persona source: {0}")]
Source(String),
#[error("setup: {0}")]
Setup(String),
#[error("checkpoint: {0}")]
Checkpoint(String),
#[error(transparent)]
Store(#[from] CoreError),
}