use alloc::string::String;
pub type Result<T> = core::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("malformed tracking id: {reason}")]
InvalidTrackingId {
reason: String,
},
#[error("tracking id does not match generator policy: {reason}")]
IdPolicyMismatch {
reason: String,
},
#[error("invalid id generator configuration: {0}")]
InvalidIdConfig(String),
#[error("could not read from the system entropy source: {0}")]
Entropy(String),
#[error("need at least {needed} bytes of entropy, got {got}")]
InsufficientEntropy {
needed: usize,
got: usize,
},
#[error("data cannot be encoded as {symbology}: {reason}")]
Unencodable {
symbology: &'static str,
reason: String,
},
#[error("cannot encode an empty payload")]
EmptyPayload,
#[error("invalid render options: {0}")]
InvalidRenderOptions(String),
#[error("rendering failed: {0}")]
Render(String),
#[error("decoding failed: {0}")]
Decode(String),
#[cfg(feature = "std")]
#[error("i/o error: {0}")]
Io(#[from] std::io::Error),
}