use crate::backtrace::BackTrace;
use alloc::string::String;
use serde::{Deserialize, Serialize};
use thiserror::Error;
#[derive(Error, Serialize, Deserialize)]
pub enum ExecutionError {
#[error("An error happened during execution\nCaused by:\n {reason}")]
WithContext {
reason: String,
},
#[error("An error happened during execution\nCaused by:\n {reason}")]
Generic {
reason: String,
#[serde(skip)]
backtrace: BackTrace,
},
}
impl core::fmt::Debug for ExecutionError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_fmt(format_args!("{self}"))
}
}