Skip to main content

recall_echo/graph/
error.rs

1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
5//! Typed error handling for recall-graph.
6
7/// All errors that recall-graph operations can produce.
8#[derive(thiserror::Error, Debug)]
9pub enum GraphError {
10    #[error("database: {0}")]
11    Db(#[from] surrealdb::Error),
12
13    #[error("store locked: {0}")]
14    Locked(String),
15
16    #[error("embedding: {0}")]
17    Embed(String),
18
19    #[error("entity not found: {0}")]
20    NotFound(String),
21
22    #[error("extraction failed: {0}")]
23    Extraction(String),
24
25    #[error("dedup failed: {0}")]
26    Dedup(String),
27
28    #[error("llm error: {0}")]
29    Llm(String),
30
31    #[error("parse error: {0}")]
32    Parse(String),
33
34    #[error("io: {0}")]
35    Io(#[from] std::io::Error),
36
37    #[error("json: {0}")]
38    Json(#[from] serde_json::Error),
39
40    #[error("immutable entity cannot be merged: {0}")]
41    ImmutableMerge(String),
42}