use crate::install::provider::InstallProviderId;
use crate::records::format_bytes;
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
pub enum InstallError {
#[error("No install provider is registered as {0}.")]
ProviderUnknown(InstallProviderId),
#[error("{0}")]
ProviderUnavailable(String),
#[error("{0} is not a reference this provider understands.")]
ReferenceInvalid(String),
#[error("{0} was not found on the platform.")]
ReferenceNotFound(String),
#[error(
"{0} is gated. Accept its terms and request access at https://huggingface.co/{0}, then set HF_TOKEN to a token with read access (or sign in with `huggingface-cli login`)."
)]
AuthRequired(String),
#[error(
"Not enough free disk space: this model needs {} and {} is available.",
format_bytes(*required_bytes),
format_bytes(*available_bytes)
)]
InsufficientDisk {
required_bytes: i64,
available_bytes: i64,
},
#[error("{0} failed checksum verification after download.")]
ChecksumMismatch(String),
#[error("{0}")]
TransferFailed(String),
}