ishell/
error.rs

1use std::fmt;
2
3/// Error type returned from constructing a shell
4///
5/// The `ShellInitError` enum represents the various errors that may occur when
6/// attempting to initialize a shell. This includes errors related to directory
7/// access permissions and existence.
8#[derive(Debug)]
9pub enum ShellInitError {
10    /// This variant indicates that an error occurred related to a directory.
11    /// It can occur when trying to construct an `IShell` inside a directory that does not exist.
12    ///
13    /// The associated `String` contains a message that provides more details about the error,
14    /// such as the directory (or variations of the directory) that could not be found.
15    ///
16    /// Display trait included.
17    DirectoryError(String),
18}
19
20impl fmt::Display for ShellInitError {
21    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
22        match self {
23            ShellInitError::DirectoryError(msg) => write!(f, "IShell directory error: {}", msg),
24        }
25    }
26}