Skip to main content

zantetsu_vecdb/
error.rs

1use thiserror::Error;
2
3/// Errors returned by title matching backends.
4#[derive(Debug, Error)]
5pub enum MatcherError {
6    /// The title query is empty or whitespace-only.
7    #[error("match query is empty or whitespace-only")]
8    EmptyQuery,
9
10    /// A dump path did not resolve to a readable SQL dump.
11    #[error("invalid Kitsu dump path: {0}")]
12    InvalidDumpPath(String),
13
14    /// The dump did not contain the expected schema or data.
15    #[error("invalid Kitsu dump format: {0}")]
16    InvalidDump(String),
17
18    /// An HTTP request failed.
19    #[error("HTTP request failed: {0}")]
20    Http(#[from] reqwest::Error),
21
22    /// A filesystem operation failed.
23    #[error("I/O error: {0}")]
24    Io(#[from] std::io::Error),
25
26    /// The remote GraphQL endpoint returned an error payload.
27    #[error("remote GraphQL error: {0}")]
28    GraphQl(String),
29
30    /// The remote response was missing expected fields.
31    #[error("invalid remote response: {0}")]
32    InvalidResponse(String),
33}
34
35/// Result type alias for title matching.
36pub type MatchResult<T> = std::result::Result<T, MatcherError>;