distributed_lock_core/
error.rs1use std::time::Duration;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
8pub enum LockError {
9 #[error("lock acquisition timed out after {0:?}")]
11 Timeout(Duration),
12
13 #[error("lock operation was cancelled")]
15 Cancelled,
16
17 #[error("deadlock detected: {0}")]
19 Deadlock(String),
20
21 #[error("connection error: {0}")]
23 Connection(#[source] Box<dyn std::error::Error + Send + Sync>),
24
25 #[error("lock was lost: {0}")]
27 LockLost(String),
28
29 #[error("invalid lock name: {0}")]
31 InvalidName(String),
32
33 #[error("backend error: {0}")]
35 Backend(#[source] Box<dyn std::error::Error + Send + Sync>),
36}
37
38pub type LockResult<T> = Result<T, LockError>;