Skip to main content

cobble_table/
error.rs

1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, TableError>;
4
5#[derive(Debug, Error)]
6#[non_exhaustive]
7pub enum TableError {
8    #[error("invalid table schema: {0}")]
9    InvalidSchema(String),
10
11    #[error("table codec error: {0}")]
12    Codec(String),
13
14    #[error(transparent)]
15    Storage(#[from] cobble::Error),
16
17    #[doc(hidden)]
18    #[error("internal table error: {0}")]
19    Internal(String),
20}
21
22impl TableError {
23    pub(crate) fn codec(message: impl Into<String>) -> Self {
24        Self::Codec(message.into())
25    }
26
27    pub(crate) fn internal(message: impl Into<String>) -> Self {
28        Self::Internal(message.into())
29    }
30}