Skip to main content

memoir_core/graph/
error.rs

1/// Failure modes for [`crate::graph::GraphStore`] implementations.
2#[derive(Debug, thiserror::Error)]
3pub enum GraphError {
4    #[error("graph backend connection failed: {0}")]
5    Connection(String),
6
7    #[error("graph query failed: {0}")]
8    Query(String),
9
10    #[error("invalid request to graph backend: {0}")]
11    BadRequest(String),
12}
13
14#[cfg(test)]
15mod tests {
16    use super::*;
17
18    #[test]
19    fn should_render_connection_error_with_message() {
20        let err = GraphError::Connection("dial failed".to_string());
21        assert_eq!(err.to_string(), "graph backend connection failed: dial failed");
22    }
23}