lonca-core 0.2.2

Deterministic building blocks of Lonca: change ids, the signed operation log, keys and the Git store
Documentation
use thiserror::Error;

#[derive(Debug, Error)]
pub enum Error {
    #[error("git: {0}")]
    Git(String),
    #[error("io: {0}")]
    Io(#[from] std::io::Error),
    #[error("json: {0}")]
    Json(#[from] serde_json::Error),
    #[error("invalid: {0}")]
    Invalid(String),
    #[error("integrity: {0}")]
    Integrity(String),
    #[error("conflict: {0}")]
    Conflict(String),
    /// Data written by a newer (or unknown) version of Lonca.
    #[error("unsupported: {0}")]
    Unsupported(String),
}

pub type Result<T, E = Error> = std::result::Result<T, E>;

#[cfg(feature = "store")]
pub(crate) fn git<E: std::fmt::Display>(e: E) -> Error {
    Error::Git(e.to_string())
}