use std::fmt;
#[derive(Debug)]
pub struct AgentRunError {
pub source: anyhow::Error,
pub restore_state: Option<serde_json::Value>,
}
impl AgentRunError {
pub fn wrap(source: anyhow::Error, restore_state: Option<serde_json::Value>) -> Self {
Self {
source,
restore_state,
}
}
}
impl fmt::Display for AgentRunError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.source)
}
}
impl std::error::Error for AgentRunError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
Some(self.source.as_ref())
}
}