1use chrono::{DateTime, Utc};
2use std::error::Error as StdError;
3use thiserror::Error;
4
5pub(crate) type BoxDynError = Box<dyn StdError + 'static + Send + Sync>;
7
8#[derive(Error, Debug)]
10pub enum Error {
11 #[error("start_time `{0}` is ahead of current time")]
13 StartTimeAheadOfCurrentTime(DateTime<Utc>),
14 #[error("machine_id returned an error: {0}")]
16 MachineIdFailed(#[source] BoxDynError),
17 #[error("check_machine_id returned false")]
19 CheckMachineIdFailed,
20 #[error("over the time limit")]
22 OverTimeLimit,
23 #[error("could not find any private ipv4 address")]
25 NoPrivateIPv4,
26 #[error("mutex is poisoned (i.e. a panic happened while it was locked)")]
28 MutexPoisoned,
29 #[error("failed to get current time")]
31 FailedToGetCurrentTime,
32 #[cfg(not(feature = "pnet"))]
33 #[error("no machine id function provided")]
36 NoMachineIdFn,
37}