Skip to main content

talos_session/
error.rs

1use thiserror::Error;
2use uuid::Uuid;
3
4/// Errors that can occur during session operations.
5#[derive(Debug, Error)]
6pub enum SessionError {
7    /// An I/O error occurred (file read/write, directory creation, etc.).
8    #[error("I/O error: {0}")]
9    IoError(#[from] std::io::Error),
10
11    /// A line in the JSONL file is not valid JSON.
12    #[error("invalid JSON in session file: {0}")]
13    InvalidJson(String),
14
15    /// The requested session was not found.
16    #[error("session not found: {0}")]
17    SessionNotFound(Uuid),
18
19    /// The requested entry ID was not found in the session.
20    #[error("entry not found: {0}")]
21    EntryNotFound(String),
22
23    /// The requested branch ID was not found.
24    #[error("branch not found: {0}")]
25    BranchNotFound(String),
26
27    /// Failed to parse a session file.
28    #[error("failed to parse session file: {0}")]
29    ParseError(String),
30
31    /// A per-session internal mutex was poisoned by a panicking thread.
32    #[error("session lock poisoned")]
33    LockPoisoned,
34}