ekv_fs/error.rs
1//! Error types returned by [`crate::EkvFs`] and [`crate::EkvFile`].
2
3/// Errors that can occur when using the virtual file system.
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub enum Error {
6 /// The path exceeds [`crate::EkvFs`]’s `MAX_PATH_LEN` const generic.
7 PathTooLong,
8 /// A storage key could not be formatted (path too long for key buffer).
9 KeyTooLong,
10 /// No file exists at the given path.
11 NotFound,
12 /// The underlying `ekv` database returned an error.
13 Database,
14 /// Metadata could not be encoded or decoded.
15 Serialize,
16}
17
18impl Error {
19 pub(crate) fn from_db<E>(_: E) -> Self {
20 Self::Database
21 }
22}