forked from aimdb-dev/aimdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.rs
More file actions
45 lines (37 loc) · 1.3 KB
/
Copy patherror.rs
File metadata and controls
45 lines (37 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Errors of the blocking facade.
use alloc::string::String;
use aimdb_core::DbError;
/// Errors from the synchronous (blocking) API.
///
/// Facade-specific failures (attach/detach, runtime-thread shutdown) are their
/// own variants; anything from the underlying database wraps a [`DbError`]
/// via [`SyncError::Db`].
#[derive(Debug, thiserror::Error)]
pub enum SyncError {
/// Failed to attach the database to the runtime thread.
#[error("Failed to attach database: {message}")]
AttachFailed {
/// Human-readable description of the failure.
message: String,
},
/// Failed to detach the database from the runtime thread.
#[error("Failed to detach database: {message}")]
DetachFailed {
/// Human-readable description of the failure.
message: String,
},
/// Timeout while setting a value.
#[error("Timeout while setting value")]
SetTimeout,
/// Timeout while getting a value.
#[error("Timeout while getting value")]
GetTimeout,
/// The runtime thread has shut down.
#[error("Runtime thread has shut down")]
RuntimeShutdown,
/// Error from the underlying database.
#[error(transparent)]
Db(#[from] DbError),
}
/// Result alias for blocking-facade operations.
pub type SyncResult<T> = Result<T, SyncError>;