use std::path::PathBuf; #[derive(Debug, thiserror::Error)] pub enum SiteError { #[error("source directory doesn't exist: {0}")] SourceDirMissing(PathBuf), #[error("failed to list files in source directory: {0}")] WalkDir(PathBuf, #[source] walkdir::Error), #[error("could not read file: {0}")] FileRead(PathBuf, #[source] std::io::Error), #[error("could not write file: {0}")] FileWrite(PathBuf, #[source] std::io::Error), #[error("string formatting error: {0}")] Format(#[source] std::fmt::Error), #[error("could not convert input text from {0} to UTF-8")] Utf8(PathBuf, #[source] std::string::FromUtf8Error), #[error("failed to canonicalize path {0}")] Canonicalize(PathBuf, #[source] std::io::Error), #[error("failed to compute relative path for {0} against {1}")] Relative(PathBuf, PathBuf), #[error("failed to create {0}")] CreateFile(PathBuf, #[source] std::io::Error), #[error("failed to copy {0} to {1}")] CopyFile(PathBuf, PathBuf, #[source] std::io::Error), #[error("failed to create directory {0}")] CreateDir(PathBuf, #[source] std::io::Error), #[error("unknown directive {0}")] UnknownDirective(String), #[error("directive {0} has more than one unnamed argument")] TooManyUnnamedArgs(String), #[error("directive {0} is missing required argument {1}")] DirectiveMissingArg(String, String), #[error("directive {0} has unknown argument {1}")] DirectiveUnknownArg(String, String), #[error("link to missing page {1} on {0}")] PageMissing(PathBuf, PathBuf), #[error("attempt to use definition lists in Markdown: {0:?}")] DefinitionList(String), #[error("failed to get file metadata: {0}")] FileMetadata(PathBuf, #[source] std::io::Error), #[error("failed to get file modification time: {0}")] FileMtime(PathBuf, #[source] std::io::Error), #[error("failed to set modification time for file {0}")] Utimensat(PathBuf, #[source] std::io::Error), #[error("failed to convert time to Unix time")] UnixTime(#[source] std::time::SystemTimeError), }