Skip to main content

nodedb_physical/kv_atomic/
error.rs

1// SPDX-License-Identifier: Apache-2.0
2
3//! Why a KV atomic computed no stored value.
4
5use super::counter_fault::CounterFault;
6
7/// Why [`super::compute`] computed no stored value for a KV atomic.
8///
9/// Each executor maps it into its own error. Origin maps it into the Data
10/// Plane `ErrorCode`, and Lite maps it into `LiteError`.
11#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
12pub enum AtomicComputeError {
13    /// A typed row has no column of the type the atomic reads.
14    #[error("{detail}")]
15    TypeMismatch { detail: String },
16    /// A counter atomic read a stored value it cannot parse as a number, or
17    /// computed a result out of range.
18    #[error("{0}")]
19    Counter(CounterFault),
20    /// The computed new value failed to re-encode as MessagePack.
21    #[error("{detail}")]
22    Encode { detail: String },
23}