Skip to main content

memoir_core/vector/
error.rs

1/// Failure modes for [`crate::vector::VectorIndex`] implementations.
2#[derive(Debug, thiserror::Error)]
3pub enum VectorError {
4    #[error("vector backend connection failed: {0}")]
5    Connection(String),
6
7    #[error("invalid request to vector backend: {0}")]
8    BadRequest(String),
9
10    #[error("vector backend resource not found: {0}")]
11    NotFound(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 = VectorError::Connection("dial failed".to_string());
21        assert_eq!(err.to_string(), "vector backend connection failed: dial failed");
22    }
23}