use crate::blueprint::conversions::raw_callable2registered_callable;
use crate::blueprint::reflection::RawCallable;
use crate::blueprint::Blueprint;
use pavex_bp_schema::{Blueprint as BlueprintSchema, Callable};
pub struct RegisteredErrorObserver<'a> {
#[allow(dead_code)]
pub(crate) blueprint: &'a mut BlueprintSchema,
}
#[derive(Clone, Debug)]
pub struct ErrorObserver {
pub(in crate::blueprint) callable: Callable,
}
impl ErrorObserver {
#[track_caller]
pub fn new(callable: RawCallable) -> Self {
Self {
callable: raw_callable2registered_callable(callable),
}
}
pub fn register(self, bp: &mut Blueprint) -> RegisteredErrorObserver {
bp.register_error_observer(self)
}
}