Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aegis-runtime-mv/blob/main/src/persistence/error.rs # aegis-runtime-mv Native Rust agent runtime: Axum WebSocket/SSE/REST gateway, heartbeat scheduler, dependency-aware task workflow, SQLite storage. Attachment of AienOS. Pre-alpha. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aegis-runtime-mv / src / persistence / error.rs` 64 lines ยท 1852 bytes Raw Blame History 1 use std::fmt; 2 3 #[derive(Debug, Clone, PartialEq, Eq)] 4 pub enum PersistenceError { 5 Sqlite(String), 6 NotFound(String), 7 ConcurrencyConflict { 8 id: String, 9 expected_version: u64, 10 }, 11 ActiveRunConflict { 12 session_id: String, 13 active_run_id: String, 14 }, 15 Serialization(String), 16 LockPoisoned, 17 TaskJoin(String), 18 Other(String), 19 } 20 21 impl fmt::Display for PersistenceError { 22 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 23 match self { 24 Self::Sqlite(e) => write!(f, "SQLite error: {e}"), 25 Self::NotFound(msg) => write!(f, "Record not found: {msg}"), 26 Self::ConcurrencyConflict { 27 id, 28 expected_version, 29 } => { 30 write!( 31 f, 32 "Concurrency conflict on {id}: expected version {expected_version}" 33 ) 34 } 35 Self::ActiveRunConflict { 36 session_id, 37 active_run_id, 38 } => { 39 write!( 40 f, 41 "Session {session_id} already has active run: {active_run_id}" 42 ) 43 } 44 Self::Serialization(e) => write!(f, "Serialization error: {e}"), 45 Self::LockPoisoned => write!(f, "Database lock poisoned"), 46 Self::TaskJoin(e) => write!(f, "Task join error: {e}"), 47 Self::Other(msg) => write!(f, "Persistence error: {msg}"), 48 } 49 } 50 } 51 52 impl std::error::Error for PersistenceError {} 53 54 impl From for PersistenceError { 55 fn from(err: rusqlite::Error) -> Self { 56 Self::Sqlite(err.to_string()) 57 } 58 } 59 60 impl From for PersistenceError { 61 fn from(err: serde_json::Error) -> Self { 62 Self::Serialization(err.to_string()) 63 } 64 }