Skip to main content

rust_relations_explorer/
errors.rs

1use std::path::PathBuf;
2use thiserror::Error;
3
4#[derive(Debug, Error)]
5pub enum ParseError {
6    #[error("Regex match failed: {0}")]
7    Regex(String),
8    #[error("IO error: {0}")]
9    Io(#[from] std::io::Error),
10    #[error("Invalid UTF-8 in file {file}")]
11    InvalidUtf8 { file: PathBuf },
12}
13
14#[derive(Debug, Error)]
15pub enum KnowledgeGraphError {
16    #[error("Parse error in file {file}: {source}")]
17    ParseError { file: PathBuf, source: ParseError },
18
19    #[error("IO error: {0}")]
20    Io(#[from] std::io::Error),
21
22    #[error("Invalid query: {0}")]
23    Query(String),
24
25    #[error("Visualization error: {0}")]
26    Visualization(String),
27}