use std::fmt::Debug;
use std::path::PathBuf;
use std::time::SystemTimeError;
use std::{error, io, result};
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("Path is not a directory: {path}")]
NotADirectory { path: PathBuf },
#[error("Path traversal detected: {path} is not within cache directory {cache_dir}")]
PathTraversal { path: PathBuf, cache_dir: PathBuf },
#[error("Invalid path: {path}")]
InvalidPath { path: PathBuf },
#[error("Invalid path: {path} has no parent directory")]
NoParentDirectory { path: PathBuf },
#[error("File already exists: {path}")]
FileAlreadyExists { path: PathBuf },
#[error("File already locked")]
FileAlreadyLocked,
#[error("File already unlocked")]
FileAlreadyUnlocked,
#[error(transparent)]
Callback(Box<dyn error::Error + Send + Sync>),
#[error(transparent)]
SystemTime(#[from] SystemTimeError),
#[error(transparent)]
IO(#[from] io::Error),
}
pub type Result<T> = result::Result<T, Error>;
#[allow(non_snake_case, clippy::unnecessary_wraps, clippy::missing_errors_doc)]
#[doc(hidden)]
pub(crate) fn Ok<T>(value: T) -> Result<T> {
Result::Ok(value)
}