Skip to main content

xtask_todo_lib/devshell/vfs/
error.rs

1//! VFS error type.
2
3/// Error from VFS operations (path not found, not a directory/file, or I/O).
4#[derive(Debug)]
5pub enum VfsError {
6    InvalidPath,
7    Io(std::io::Error),
8}
9
10impl std::fmt::Display for VfsError {
11    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12        match self {
13            Self::InvalidPath => f.write_str("invalid path"),
14            Self::Io(e) => write!(f, "io: {e}"),
15        }
16    }
17}
18
19impl std::error::Error for VfsError {
20    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
21        match self {
22            Self::Io(e) => Some(e),
23            Self::InvalidPath => None,
24        }
25    }
26}