1pub type Result<T, E = GraphOperationError> = std::result::Result<T, E>;
3
4#[derive(thiserror::Error, Debug, Eq, PartialEq)]
6pub enum GraphOperationError {
7 #[error("this vertex_id already exists in the graph")]
9 VertexAlreadyExists,
10 #[error("this vertex_id does not exist in the graph")]
12 VertexDoesNotExist,
13 #[error("unable to find edge in graph between two vertices")]
15 EdgeDoesNotExist,
16}
17
18#[derive(thiserror::Error, Debug, Eq, PartialEq)]
20pub enum ParseGraphError {
21 #[error("incorrect vertex definition at line {0}")]
23 VertexDefinition(usize),
24 #[error("incorrect edge definition at line {0}")]
26 EdgeDefinition(usize),
27
28 #[error("vertex with index {0} already defined, check line {1}")]
29 VertexAlreadyDefined(usize, usize),
31 #[error("failed to join vertices with ids {0}, {1} because they are not defined at line {2}")]
33 VerticesNotDefined(usize, usize, usize),
34
35 #[error("failed to parse index of the vertex or edge at line {0}")]
37 ParseInt(usize),
38 #[error("failed to parse label data of the vertex or edge at line {0}")]
40 ParseLabel(usize),
41
42 #[error("some graph operation failed: {0} at line {1}")]
44 GraphError(GraphOperationError, usize),
45}