radixdb_core/error/
code.rs1use std::fmt;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
5pub enum ErrorCategory {
6 Catalog,
7 Value,
8 Constraint,
9 Transaction,
10 Index,
11 Engine,
12 Query,
13 Security,
14 Durability,
15 Database,
16 Evaluation,
17 Syntax,
18 Io,
19 Internal,
20}
21
22#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
24pub struct ErrorCode(&'static str);
25
26impl ErrorCode {
27 pub(super) const fn new(value: &'static str) -> Self {
28 Self(value)
29 }
30
31 pub const fn as_str(self) -> &'static str {
32 self.0
33 }
34}
35
36impl fmt::Display for ErrorCode {
37 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
38 formatter.write_str(self.0)
39 }
40}