reifydb_core/error/
mod.rs1use reifydb_value::{
5 error::{Error, IntoDiagnostic, TypeError},
6 fragment::Fragment,
7 value::{duration::Duration, value_type::ValueType},
8};
9
10pub mod diagnostic;
11
12#[derive(Debug, thiserror::Error)]
13pub enum CoreError {
14 #[error(transparent)]
15 Type(#[from] TypeError),
16
17 #[error("variable-length types (UTF8, BLOB) are not supported in indexes")]
18 IndexVariableLengthNotSupported,
19
20 #[error("mismatch between number of types ({types_len}) and directions ({directions_len})")]
21 IndexTypesDirectionsMismatch {
22 types_len: usize,
23 directions_len: usize,
24 },
25
26 #[error("Frame processing error: {message}")]
27 FrameError {
28 message: String,
29 },
30
31 #[error("cannot append rows: '{column}' is present on one side but not the other")]
32 AppendSystemColumnMismatch {
33 column: String,
34 },
35
36 #[error("operator setting '{key}' is a count ({count}), but this operator seals by time")]
37 OperatorWithCountSpan {
38 key: &'static str,
39 count: u64,
40 },
41
42 #[error("immutable {immutable} must be strictly less than lateness {lateness}")]
43 OperatorWithImmutableNotBelowLateness {
44 immutable: Duration,
45 lateness: Duration,
46 },
47
48 #[error("this operator needs 'window' in its with block")]
49 OperatorWithWindowMissing,
50
51 #[error("this operator needs 'pane' in its rolling window's with block")]
52 OperatorWithPaneMissing,
53
54 #[error("window '{kind}' is not supported by this operator, use '{supported}'")]
55 OperatorWithWindowKindUnsupported {
56 kind: &'static str,
57 supported: String,
58 },
59
60 #[error("this operator takes no window, but window '{kind}' was given")]
61 OperatorWithWindowNotSupported {
62 kind: &'static str,
63 },
64
65 #[error("the window size is a count ({count}), but this operator windows by time")]
66 OperatorWithWindowSizeCount {
67 count: u64,
68 },
69
70 #[error("the window size is a duration ({size}), but this operator counts slots")]
71 OperatorWithWindowSizeDuration {
72 size: Duration,
73 },
74
75 #[error("the window slide is a count ({count}), but this operator windows by time")]
76 OperatorWithWindowSlideCount {
77 count: u64,
78 },
79
80 #[error("the window slide is a duration ({slide}), but this operator counts slots")]
81 OperatorWithWindowSlideDuration {
82 slide: Duration,
83 },
84
85 #[error("a session window seals on its gap and takes no lateness (lateness: {lateness})")]
86 OperatorWithSessionLateness {
87 lateness: Duration,
88 },
89
90 #[error("a session window needs a gap above zero")]
91 OperatorWithSessionZeroGap,
92
93 #[error("operator setting '{key}' is a duration ({duration}), but this operator seals by count")]
94 OperatorWithDurationSpan {
95 key: &'static str,
96 duration: Duration,
97 },
98
99 #[error("a nostate operator takes no 'with'")]
100 OperatorWithNotAccepted,
101
102 #[error("a managed operator needs 'retention' or 'lateness'")]
103 OperatorRetentionRequired,
104
105 #[error("this operator takes no 'retention'")]
106 OperatorWithRetentionNotSupported,
107
108 #[error("retention {retention} must not be below lateness {lateness}")]
109 OperatorWithRetentionBelowLateness {
110 retention: Duration,
111 lateness: Duration,
112 },
113
114 #[error("timer kind '{kind}' is reserved for the engine")]
115 OperatorTimerKindReserved {
116 kind: &'static str,
117 },
118
119 #[error("cannot use column `{column}` in a primary key: a {ty} value cannot be a key")]
120 PrimaryKeyDigestColumn {
121 fragment: Fragment,
122 column: String,
123 ty: ValueType,
124 },
125
126 #[error("expected {expected}, got {actual}")]
127 DigestWriteTypeMismatch {
128 fragment: Fragment,
129 expected: ValueType,
130 actual: ValueType,
131 },
132
133 #[error("sequence generator of type `{value_type}` is exhausted")]
134 SequenceExhausted {
135 value_type: ValueType,
136 },
137
138 #[error("{subsystem} subsystem initialization failed: {reason}")]
139 SubsystemInitFailed {
140 subsystem: String,
141 reason: String,
142 },
143
144 #[error("Required feature '{feature}' is not enabled")]
145 SubsystemFeatureDisabled {
146 feature: String,
147 },
148
149 #[error("Failed to bind to {addr}: {reason}")]
150 SubsystemBindFailed {
151 addr: String,
152 reason: String,
153 },
154
155 #[error("Failed to get local address: {reason}")]
156 SubsystemAddressUnavailable {
157 reason: String,
158 },
159}
160
161impl From<CoreError> for Error {
162 fn from(err: CoreError) -> Self {
163 Error(Box::new(err.into_diagnostic()))
164 }
165}