Skip to main content

llm_sync/
error.rs

1// SPDX-License-Identifier: MIT
2use thiserror::Error;
3
4/// All errors that can occur in the llm-sync crate.
5#[derive(Debug, Error)]
6pub enum SyncError {
7    /// A node id was not found in the vector clock.
8    #[error("Node '{0}' not found in vector clock")]
9    NodeNotFound(String),
10
11    /// A CRDT merge conflict that cannot be automatically resolved.
12    #[error("Merge conflict: cannot automatically resolve for key '{key}'")]
13    MergeConflict { key: String },
14
15    /// JSON serialization or deserialization failed.
16    #[error("Serialization error: {0}")]
17    Serialization(#[from] serde_json::Error),
18
19    /// The system is in an invalid state.
20    #[error("Invalid state: {0}")]
21    InvalidState(String),
22
23    /// A sync session was not found or has expired.
24    #[error("Session '{0}' expired or not found")]
25    SessionNotFound(String),
26}