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,
},
#[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,
},
#[error("failed to serialize to JSON")]
SerJsonError {
#[from]
source: serde_json::Error,
},
}
pub trait Errors {
fn errors(&self) -> Box<dyn Iterator<Item = Box<&dyn std::error::Error>> + '_>;
}