use std::fmt::Debug;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("internal error: {msg}")]
InternalError { msg: &'static str },
#[error("resolver failed")]
ResolverError {
#[from]
source: crate::resolver::Error,
},
#[cfg(feature = "services")]
#[error("external service failed")]
ServiceError {
#[from]
source: crate::services::Error,
},
#[error("failed to parse '{what}' to {to} because {why}")]
ParserError {
what: String,
to: &'static str,
why: String,
},
#[error("failed to execute IO operation for")]
IoError {
#[from]
source: std::io::Error,
},
#[cfg(feature = "serde_json")]
#[error("failed to serialize to JSON")]
SerJsonError {
#[from]
source: serde_json::Error,
},
#[error("failed to parse zone file '{path}': {reason}")]
ZoneFileError { path: String, reason: String },
}
pub trait Errors {
fn errors(&self) -> Box<dyn Iterator<Item = Box<&dyn std::error::Error>> + '_>;
}