a73x

src/error.rs

Ref:   Size: 1.3 KiB

use thiserror::Error;

#[derive(Debug, Error)]
pub enum Error {
    #[error(transparent)]
    Git(#[from] git2::Error),

    #[error(transparent)]
    Json(#[from] serde_json::Error),

    #[error("{0}")]
    Cmd(String),

    #[error(transparent)]
    Io(#[from] std::io::Error),

    #[error("signing error: {0}")]
    Signing(String),

    #[error("verification error: {0}")]
    Verification(String),

    #[error("no signing key found — run 'collab init-key' to generate one")]
    KeyNotFound,

    #[error("untrusted key: {0}")]
    UntrustedKey(String),

    #[error("another sync is in progress (pid {pid}, started {since})")]
    SyncLocked { pid: u32, since: String },

    #[error("sync partially failed: {succeeded} of {total} refs pushed")]
    PartialSync { succeeded: usize, total: usize },

    #[error("event.json blob exceeds {limit} byte limit (actual: {actual})")]
    PayloadTooLarge { actual: usize, limit: usize },

    #[error("invalid ref name: {0}")]
    InvalidRefName(String),

    #[error("ambiguous id prefix '{prefix}': {count} matches")]
    AmbiguousId { prefix: String, count: usize },

    #[error("disjoint histories: local ref '{local_ref}' and remote ref '{remote_ref}' share no common ancestor ({detail})")]
    DisjointHistories {
        local_ref: String,
        remote_ref: String,
        detail: String,
    },
}