use thiserror::Error;
#[derive(Error, Debug, Copy, Clone)]
#[error("Cannot {} from {}, {}", operation, propagator_name, message)]
pub struct Error {
pub message: &'static str,
propagator_name: &'static str,
operation: &'static str,
}
impl Error {
#[must_use]
pub fn extract(message: &'static str, propagator_name: &'static str) -> Self {
Self {
message,
propagator_name,
operation: "extract",
}
}
#[allow(clippy::must_use_candidate)]
pub fn inject(message: &'static str, propagator_name: &'static str) -> Self {
Self {
message,
propagator_name,
operation: "inject",
}
}
}