indexed_struct_core/
error.rs

1use thiserror::Error;
2
3/// Error types for indexed-struct operations.
4#[derive(Debug, Error)]
5pub enum Error {
6    /// Trying to insert a row with a key that already exists.
7    #[error("Conflict key")]
8    ConflictKey,
9
10    /// Trying to insert or update a row that would violate a unique constraint.
11    #[error("Conflict unique field: {0}")]
12    ConflictUniqueField(&'static str),
13
14    /// Trying to access a row that does not exist.
15    #[error("Row not found")]
16    RowNotFound,
17}
18
19/// A type alias for [std::result::Result] with [Error] as the error type.
20pub type Result<T> = std::result::Result<T, Error>;