arangors_graph_exporter/
errors.rs

1use reqwest_middleware::Error as ReqwestError;
2use thiserror::Error; // Alias to disambiguate from other error types
3#[derive(Error, Debug)]
4pub enum GraphLoaderError {
5    #[error("Both vertex and edge collections are empty.")]
6    EmptyCollections,
7
8    #[error("Graph not found")]
9    GraphNotFound,
10
11    #[error("Error parsing TLS certificate: {0}")]
12    TlsCertError(String),
13
14    #[error("Error building request client: {0}")]
15    RequestBuilderError(String),
16
17    #[error("No database servers found")]
18    NoDatabaseServers,
19
20    #[error("UTF-8 error: {0}")]
21    Utf8Error(String),
22
23    #[error("Request error: {0}")]
24    RequestError(#[from] ReqwestError),
25
26    #[error("ArangoDB error: code {0}, message: {1}, HTTP status code: {2}")]
27    ArangoDBError(i32, String, reqwest::StatusCode),
28
29    #[error("Error parsing response body: {0}")]
30    ParseError(String),
31
32    #[error("Invalid HTTP status code: {0}")]
33    InvalidStatusCode(reqwest::StatusCode),
34
35    #[error("Graph is not an object")]
36    GraphNotObject,
37
38    #[error("No edge definitions found")]
39    NoEdgeDefinitions,
40
41    #[error("Edge definitions found, but an array")]
42    EdgeDefinitionsNotArray,
43
44    #[error("Collection is not a string")]
45    CollectionNotString,
46
47    #[error("From is not an array")]
48    FromNotArray,
49
50    #[error("From collection is not a string")]
51    FromCollectionNotString,
52
53    #[error("To is not an array")]
54    ToNotArray,
55
56    #[error("To collection is not a string")]
57    ToCollectionNotString,
58
59    #[error("JSON parse error:\n{0}")]
60    JsonParseError(String),
61
62    #[error("{0}")]
63    Other(String), // Variant to handle generic String errors
64}
65
66impl From<String> for GraphLoaderError {
67    fn from(err: String) -> Self {
68        GraphLoaderError::Other(err)
69    }
70}