use url::Url;
use crate::query::TextFile;
#[derive(Debug, Clone, thiserror::Error)]
pub enum EureQueryError {
#[error("Content not found: {0}")]
ContentNotFound(TextFile),
#[error("Rate limit exceeded for URL {0}: possible infinite invalidation loop detected")]
RateLimitExceeded(Url),
#[error("Offline mode: no cached version available for {0}")]
OfflineNoCache(Url),
#[error(
"Remote host not allowed: {host} (URL: {url}). If you trust this host, add it to security.allowed-hosts in Eure.eure"
)]
HostNotAllowed { url: Url, host: String },
#[error("Invalid URL '{url}': {reason}")]
InvalidUrl { url: String, reason: String },
}
#[derive(Debug, thiserror::Error)]
#[error("{kind}")]
pub struct FileError<T: std::error::Error> {
pub file: TextFile,
pub kind: T,
}
impl<T: std::error::Error + Clone> Clone for FileError<T> {
fn clone(&self) -> Self {
Self {
file: self.file.clone(),
kind: self.kind.clone(),
}
}
}