cognee_visualization/error.rs
1//! Error types for the visualization crate.
2
3use thiserror::Error;
4
5/// Errors that can occur while generating an HTML graph visualization.
6#[derive(Debug, Error)]
7pub enum VisualizationError {
8 /// Error returned by the underlying graph database when fetching data.
9 #[error("Graph DB error: {0}")]
10 GraphDb(#[from] cognee_graph::GraphDBError),
11
12 /// JSON serialization failed while embedding graph data into the template.
13 #[error("JSON error: {0}")]
14 Json(#[from] serde_json::Error),
15
16 /// Filesystem IO error while writing the HTML file.
17 #[error("IO error: {0}")]
18 Io(#[from] std::io::Error),
19
20 /// Neither `dirs::home_dir()` nor the `HOME` / `USERPROFILE` environment
21 /// variables yielded a valid path, so the default output location cannot
22 /// be resolved.
23 #[error("Could not determine home directory for default output path")]
24 NoHomeDir,
25}