notesmachine/server/nm-store/src/errors.rs

21 lines
580 B
Rust

use thiserror::Error;
/// All the ways looking up objects can fail
#[derive(Error, Debug)]
pub enum NoteStoreError {
/// When building a new note for the back-end, it failed to parse
/// in some critical way.
#[error("Invalid Note Structure")]
InvalidNoteStructure(String),
/// The requested kasten or note was not found. As much as
/// possible, this should be preferred to a
/// sqlx::Error::RowNotFound.
#[error("Not found")]
NotFound,
/// All other errors from the database.
#[error("Sqlx")]
DBError(#[from] sqlx::Error),
}