#[non_exhaustive]pub enum SsgError {
InvalidPath {
path: String,
reason: &'static str,
},
UnsafeCleanTarget {
path: PathBuf,
reason: &'static str,
},
Io {
path: PathBuf,
source: Error,
},
Pages(Vec<(String, SsgError)>),
}Available on crate feature
ssg only.Expand description
Why a static site operation failed.
A real error type rather than io::Error::other(String), so a caller can tell an
unsafe path from a full disk and can read which page of a bulk build failed. It
converts into io::Error (? works in a function returning io::Result), keeping
InvalidInput for the two refusals.
§Examples
use molt::ssg::{SsgError, StaticSiteGenerator};
let site = StaticSiteGenerator::new("dist");
let error = site.write_file("x", "../escape.html").expect_err("refused");
assert!(matches!(error, SsgError::InvalidPath { .. }));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
InvalidPath
A page or asset path that cannot be written under the output directory: a .., a
root or drive prefix, no file name, or a symbolic link on the way.
UnsafeCleanTarget
clean refused to delete the output directory.
Io
The filesystem failed.
Fields
Pages(Vec<(String, SsgError)>)
Several pages of a bulk build failed. Every failure is here, not just the first.
Trait Implementations§
Source§impl Error for SsgError
impl Error for SsgError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for SsgError
impl !UnwindSafe for SsgError
impl Freeze for SsgError
impl Send for SsgError
impl Sync for SsgError
impl Unpin for SsgError
impl UnsafeUnpin for SsgError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more