aeo_graph_explorer/error.rs
1//! Crate-wide error type.
2
3use thiserror::Error;
4
5/// Anything that can go wrong inside the crate.
6#[derive(Debug, Error)]
7pub enum GraphError {
8 /// A JSONL line was not valid JSON.
9 #[error("failed to parse JSONL line {line}: {source}")]
10 JsonLine {
11 /// 1-based line number for operator-friendly messages.
12 line: usize,
13 /// Underlying serde error.
14 #[source]
15 source: serde_json::Error,
16 },
17
18 /// A node referenced by an edge was not present in the input.
19 #[error("unknown node id: {0}")]
20 UnknownNode(String),
21
22 /// A request asked about a node that isn't in the loaded graph.
23 #[error("node not found in graph: {0}")]
24 NotFound(String),
25
26 /// `/find-by-claim` requires at least one of `predicate` or `value`.
27 #[error("at least one of `predicate` or `value` must be supplied")]
28 EmptyQuery,
29}