1use std::fmt;
4
5#[derive(Debug)]
7pub enum SupabaseError {
8 AuthenticationError(String),
10 InsertionError(String),
12 UpdateError(String),
14 DeletionError(String),
16 FetchError(String),
18}
19
20impl fmt::Display for SupabaseError {
22 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
23 match self {
24 SupabaseError::AuthenticationError(msg) => write!(f, "Authentication Error: {}", msg),
25 SupabaseError::InsertionError(msg) => write!(f, "Insertion Error: {}", msg),
26 SupabaseError::UpdateError(msg) => write!(f, "Update Error: {}", msg),
27 SupabaseError::DeletionError(msg) => write!(f, "Deletion Error: {}", msg),
28 SupabaseError::FetchError(msg) => write!(f, "Fetch Error: {}", msg),
29 }
30 }
31}
32
33impl std::error::Error for SupabaseError {}
35
36#[derive(Debug)]
38pub enum TableConfigError {
39 InvalidConfiguration(String),
41 FileNotFound(String),
43 ParseError(String),
45}
46
47impl fmt::Display for TableConfigError {
49 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
50 match self {
51 TableConfigError::InvalidConfiguration(msg) => write!(f, "Invalid Configuration: {}", msg),
52 TableConfigError::FileNotFound(msg) => write!(f, "File Not Found: {}", msg),
53 TableConfigError::ParseError(msg) => write!(f, "Parse Error: {}", msg),
54 }
55 }
56}
57
58impl std::error::Error for TableConfigError {}
60
61#[derive(Debug)]
63pub enum XylexApiError {
64 NetworkError(String),
66 InvalidSymbol(String),
68 UnexpectedError(String),
70 EnvAuthenticationError(String),
72}
73
74impl fmt::Display for XylexApiError {
76 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
77 match self {
78 XylexApiError::NetworkError(msg) => write!(f, "Network error: {}", msg),
79 XylexApiError::InvalidSymbol(symbol) => write!(f, "Invalid symbol provided: {}", symbol),
80 XylexApiError::UnexpectedError(info) => write!(f, "An unexpected error occurred: {}", info),
81 XylexApiError::EnvAuthenticationError(msg) => write!(f, "Environment-based authentication error: {}", msg),
82 }
83 }
84}
85
86impl std::error::Error for XylexApiError {}