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
46
47
48
49
use thiserror::Error;
#[derive(Debug, Error)]
pub enum IgniteError {
#[error("transport error: {0}")]
Transport(#[from] crate::transport::TransportError),
#[error("protocol error: {0}")]
Protocol(#[from] crate::protocol::ProtocolError),
#[error("pool error: {0}")]
Pool(String),
/// Returned by `check_active()` inside a transaction. In practice this guard
/// is unreachable from external code because `commit()` and `rollback()` both
/// consume `self`, but the check is retained for defensive correctness.
#[error("transaction already committed or rolled back")]
TransactionFinished,
/// Reserved for future use when stream cursor state is explicitly tracked.
/// Currently never returned — stream resource-close is fire-and-forget.
#[error("cursor already consumed or closed")]
CursorClosed,
/// Reserved for future single-row convenience helpers such as
/// `QueryResult::exactly_one()`. Currently never returned by any code path.
#[error("query returned no rows")]
NoRows,
/// An internal `std::sync::Mutex` guarding client-side state (e.g. the
/// binary-type metadata cache) was poisoned by a prior panic while held.
#[error("internal lock poisoned: {0}")]
PoisonedLock(&'static str),
/// Returned by [`crate::cache::IgniteCache::get_binary`]/`put_binary` on a
/// transactional cache handle: binary-object metadata lookups need the
/// channel registry, which `Transaction::cache` handles don't carry (they
/// route through the transaction's dedicated connection instead).
#[error("{0} is not supported on a transactional cache handle")]
UnsupportedOnTransaction(&'static str),
}
pub type Result<T> = std::result::Result<T, IgniteError>;
impl From<deadpool::managed::PoolError<crate::transport::TransportError>> for IgniteError {
fn from(e: deadpool::managed::PoolError<crate::transport::TransportError>) -> Self {
IgniteError::Pool(e.to_string())
}
}