1use std::time::SystemTime;
2
3#[derive(Debug, thiserror::Error)]
5pub enum Error {
6 #[error("config: {0}")]
8 Config(String),
9 #[error("certificate: {0}")]
11 Cert(String),
12 #[error("acme: {0}")]
14 Acme(String),
15 #[error("challenge: {0}")]
17 Challenge(String),
18 #[error("store: {0}")]
20 Store(String),
21 #[error("the last certificate was issued too recently to force a renewal")]
23 TooSoon(SystemTime),
24 #[error(transparent)]
26 Io(#[from] std::io::Error),
27}
28
29pub type Result<T, E = Error> = std::result::Result<T, E>;
31
32impl From<instant_acme::Error> for Error {
33 fn from(e: instant_acme::Error) -> Self {
34 Error::Acme(e.to_string())
35 }
36}
37
38impl From<rcgen::Error> for Error {
39 fn from(e: rcgen::Error) -> Self {
40 Error::Cert(e.to_string())
41 }
42}
43
44impl From<serde_json::Error> for Error {
45 fn from(e: serde_json::Error) -> Self {
46 Error::Store(e.to_string())
47 }
48}