reifydb_core/error/
mod.rs1use reifydb_type::{
5 error::{Error, IntoDiagnostic, TypeError},
6 fragment::Fragment,
7 value::r#type::Type,
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("Flow processing error: {message}")]
32 FlowError {
33 message: String,
34 },
35
36 #[error("FlowTransaction keyspace overlap: key {key} was already written")]
37 FlowTransactionKeyspaceOverlap {
38 key: String,
39 },
40
41 #[error("Flow {flow_id} is already registered")]
42 FlowAlreadyRegistered {
43 flow_id: u64,
44 },
45
46 #[error("Flow {flow_id} version data is corrupted")]
47 FlowVersionCorrupted {
48 flow_id: u64,
49 byte_count: usize,
50 },
51
52 #[error("Timeout waiting for flow {flow_id} backfill")]
53 FlowBackfillTimeout {
54 flow_id: u64,
55 timeout_secs: u64,
56 },
57
58 #[error("Flow dispatcher is unavailable")]
59 FlowDispatcherUnavailable,
60
61 #[error("Primary key violation in table '{table_name}'")]
62 PrimaryKeyViolation {
63 fragment: Fragment,
64 table_name: String,
65 key_columns: Vec<String>,
66 },
67
68 #[error("Unique index violation in index '{index_name}' on table '{table_name}'")]
69 UniqueIndexViolation {
70 fragment: Fragment,
71 table_name: String,
72 index_name: String,
73 key_columns: Vec<String>,
74 },
75
76 #[error("Internal error: {message}")]
77 Internal {
78 message: String,
79 file: String,
80 line: u32,
81 column: u32,
82 function: String,
83 module_path: String,
84 },
85
86 #[error("{component} is shutting down")]
87 Shutdown {
88 component: String,
89 },
90
91 #[error("sequence generator of type `{value_type}` is exhausted")]
92 SequenceExhausted {
93 value_type: Type,
94 },
95
96 #[error("cannot alter sequence for non-AUTO INCREMENT column")]
97 CanNotAlterNotAutoIncrement {
98 fragment: Fragment,
99 },
100
101 #[error("{subsystem} subsystem initialization failed: {reason}")]
102 SubsystemInitFailed {
103 subsystem: String,
104 reason: String,
105 },
106
107 #[error("Required feature '{feature}' is not enabled")]
108 SubsystemFeatureDisabled {
109 feature: String,
110 },
111
112 #[error("Failed to bind to {addr}: {reason}")]
113 SubsystemBindFailed {
114 addr: String,
115 reason: String,
116 },
117
118 #[error("{subsystem} subsystem shutdown failed: {reason}")]
119 SubsystemShutdownFailed {
120 subsystem: String,
121 reason: String,
122 },
123
124 #[error("Failed to get local address: {reason}")]
125 SubsystemAddressUnavailable {
126 reason: String,
127 },
128
129 #[error("Socket configuration failed: {reason}")]
130 SubsystemSocketConfigFailed {
131 reason: String,
132 },
133}
134
135impl From<CoreError> for Error {
136 fn from(err: CoreError) -> Self {
137 Error(err.into_diagnostic())
138 }
139}