1pub type Result<T> = core::result::Result<T, Error>;
2
3#[derive(Debug)]
4pub enum Error {
5 Database(String),
6 Io(String),
7 Config(String),
8}
9
10impl std::fmt::Display for Error {
11 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12 write!(f, "{self:?}")
13 }
14}
15
16impl std::error::Error for Error {}
17
18mod froms {
19 use super::*;
20
21 impl From<crate::ConfigError> for Error {
22 fn from(value: crate::ConfigError) -> Self {
23 Self::Config(value.to_string())
24 }
25 }
26
27 impl From<surrealdb::Error> for Error {
28 fn from(value: surrealdb::Error) -> Self {
29 Self::Database(value.to_string())
30 }
31 }
32
33 impl From<std::io::Error> for Error {
34 fn from(value: std::io::Error) -> Self {
35 Self::Io(value.to_string())
36 }
37 }
38}