shorterdb/
errors.rs

1use std::io;
2use thiserror::Error;
3
4/// Error type for kvs.
5#[derive(Error, Debug)]
6pub enum ShortDBErrors {
7    /// IO error.
8    #[error("IO error: {0}")]
9    Io(#[from] io::Error),
10
11    /// WAL file is corrupted (partial write detected).
12    #[error("WAL corruption detected")]
13    WalCorruption,
14
15    /// SST file is corrupted.
16    #[error("SST corruption: {0}")]
17    SstCorruption(String),
18
19    /// UTF-8 encoding error.
20    #[error("UTF-8 error: {0}")]
21    Utf8(#[from] std::string::FromUtf8Error),
22}
23
24/// Result type for kvs.
25pub type Result<T> = std::result::Result<T, ShortDBErrors>;