reifydb_core/error/
mod.rs1use reifydb_type::{
16 error::{Error, IntoDiagnostic, TypeError},
17 fragment::Fragment,
18 value::r#type::Type,
19};
20
21pub mod diagnostic;
22
23#[derive(Debug, thiserror::Error)]
24pub enum CoreError {
25 #[error(transparent)]
26 Type(#[from] TypeError),
27
28 #[error("variable-length types (UTF8, BLOB) are not supported in indexes")]
29 IndexVariableLengthNotSupported,
30
31 #[error("mismatch between number of types ({types_len}) and directions ({directions_len})")]
32 IndexTypesDirectionsMismatch {
33 types_len: usize,
34 directions_len: usize,
35 },
36
37 #[error("Frame processing error: {message}")]
38 FrameError {
39 message: String,
40 },
41
42 #[error("Flow processing error: {message}")]
43 FlowError {
44 message: String,
45 },
46
47 #[error("FlowTransaction keyspace overlap: key {key} was already written")]
48 FlowTransactionKeyspaceOverlap {
49 key: String,
50 },
51
52 #[error("Flow {flow_id} is already registered")]
53 FlowAlreadyRegistered {
54 flow_id: u64,
55 },
56
57 #[error("Flow {flow_id} version data is corrupted")]
58 FlowVersionCorrupted {
59 flow_id: u64,
60 byte_count: usize,
61 },
62
63 #[error("Timeout waiting for flow {flow_id} backfill")]
64 FlowBackfillTimeout {
65 flow_id: u64,
66 timeout_secs: u64,
67 },
68
69 #[error("Flow dispatcher is unavailable")]
70 FlowDispatcherUnavailable,
71
72 #[error("Primary key violation in table '{table_name}'")]
73 PrimaryKeyViolation {
74 fragment: Fragment,
75 table_name: String,
76 key_columns: Vec<String>,
77 },
78
79 #[error("Unique index violation in index '{index_name}' on table '{table_name}'")]
80 UniqueIndexViolation {
81 fragment: Fragment,
82 table_name: String,
83 index_name: String,
84 key_columns: Vec<String>,
85 },
86
87 #[error("Internal error: {message}")]
88 Internal {
89 message: String,
90 file: String,
91 line: u32,
92 column: u32,
93 function: String,
94 module_path: String,
95 },
96
97 #[error("{component} is shutting down")]
98 Shutdown {
99 component: String,
100 },
101
102 #[error("sequence generator of type `{value_type}` is exhausted")]
103 SequenceExhausted {
104 value_type: Type,
105 },
106
107 #[error("cannot alter sequence for non-AUTO INCREMENT column")]
108 CanNotAlterNotAutoIncrement {
109 fragment: Fragment,
110 },
111
112 #[error("{subsystem} subsystem initialization failed: {reason}")]
113 SubsystemInitFailed {
114 subsystem: String,
115 reason: String,
116 },
117
118 #[error("Required feature '{feature}' is not enabled")]
119 SubsystemFeatureDisabled {
120 feature: String,
121 },
122
123 #[error("Failed to bind to {addr}: {reason}")]
124 SubsystemBindFailed {
125 addr: String,
126 reason: String,
127 },
128
129 #[error("{subsystem} subsystem shutdown failed: {reason}")]
130 SubsystemShutdownFailed {
131 subsystem: String,
132 reason: String,
133 },
134
135 #[error("Failed to get local address: {reason}")]
136 SubsystemAddressUnavailable {
137 reason: String,
138 },
139
140 #[error("Socket configuration failed: {reason}")]
141 SubsystemSocketConfigFailed {
142 reason: String,
143 },
144}
145
146impl From<CoreError> for Error {
147 fn from(err: CoreError) -> Self {
148 Error(Box::new(err.into_diagnostic()))
149 }
150}