Skip to main content

source_fs/
errors.rs

1use std::path::PathBuf;
2use thiserror::Error;
3
4/// Errors that can occur when loading or using the FileSystem.
5#[derive(Error, Debug)]
6pub enum FileSystemError {
7    /// The `gameinfo.txt` file was not found in the specified path.
8    #[error("gameinfo.txt not found in {0}")]
9    GameInfoNotFound(PathBuf),
10
11    /// The provided game path is invalid (e.g., it has no parent or file name).
12    #[error("invalid game path (missing parent or file name): {0}")]
13    InvalidGamePath(PathBuf),
14
15    /// The `gameinfo.txt` file could not be parsed.
16    #[error("failed to parse gameinfo.txt")]
17    GameInfoParseError,
18
19    /// An error occurred while using `steamlocate`.
20    #[cfg(feature = "steam")]
21    #[error("steamlocate error: {0}")]
22    SteamLocateError(#[from] steamlocate::Error),
23
24    /// The specified Steam App ID was not found.
25    #[cfg(feature = "steam")]
26    #[error("steam app {0} not found")]
27    SteamAppNotFound(u32),
28
29    /// The Steam installation could not be found.
30    #[cfg(feature = "steam")]
31    #[error("steam installation not found")]
32    SteamNotFound,
33}