#[non_exhaustive]pub enum StaticError {
NotFound(String),
Traversal(String),
Io(Error),
PipelineSetup(String),
Build(String),
}Expand description
Errors that can occur during static file serving.
This error type is non-exhaustive and may gain new variants in future releases.
§Variants
NotFound: The requested path does not exist.Traversal: The requested path attempts to escape the server root.Io: An I/O error occurred (file read, permission denied, etc.).PipelineSetup: A configured CSS/JS tool’s binary is missing fromPATH, discovered at server startup (orcrate::Server::build) before any build runs.Build: A configured build pipeline (CSS/JS tool or asset folder) failed to produce output.
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.
NotFound(String)
Requested path does not exist.
Traversal(String)
Path traversal attempt detected.
Io(Error)
I/O error from the filesystem.
PipelineSetup(String)
A configured build-pipeline tool could not be found or validated at startup.
Build(String)
A configured build pipeline ran but failed to produce output.
Implementations§
Source§impl StaticError
impl StaticError
Sourcepub fn user_message(&self) -> &'static str
pub fn user_message(&self) -> &'static str
Returns a user-safe error message for use in HTTP responses.
Traversal errors return “not found” to avoid leaking information about the filesystem structure. I/O errors return “internal server error”.
Trait Implementations§
Source§impl Debug for StaticError
impl Debug for StaticError
Source§impl Display for StaticError
impl Display for StaticError
Source§impl Error for StaticError
impl Error for StaticError
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 StaticError
impl !UnwindSafe for StaticError
impl Freeze for StaticError
impl Send for StaticError
impl Sync for StaticError
impl Unpin for StaticError
impl UnsafeUnpin for StaticError
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