use std::time::SystemTime;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("config: {0}")]
Config(String),
#[error("certificate: {0}")]
Cert(String),
#[error("acme: {0}")]
Acme(String),
#[error("challenge: {0}")]
Challenge(String),
#[error("store: {0}")]
Store(String),
#[error("the last certificate was issued too recently to force a renewal")]
TooSoon(SystemTime),
#[error(transparent)]
Io(#[from] std::io::Error),
}
pub type Result<T, E = Error> = std::result::Result<T, E>;
impl From<instant_acme::Error> for Error {
fn from(e: instant_acme::Error) -> Self {
Error::Acme(e.to_string())
}
}
impl From<rcgen::Error> for Error {
fn from(e: rcgen::Error) -> Self {
Error::Cert(e.to_string())
}
}
impl From<serde_json::Error> for Error {
fn from(e: serde_json::Error) -> Self {
Error::Store(e.to_string())
}
}