1use thiserror::Error;
4use uuid::Uuid;
5
6#[derive(Debug, Error)]
7pub enum CognifyError {
8 #[error("Configuration error: {0}")]
9 ConfigError(String),
10
11 #[error("Chunking error: {0}")]
12 ChunkingError(String),
13
14 #[error("Graph extraction error: {0}")]
15 GraphExtractionError(String),
16
17 #[error("Summarization error: {0}")]
18 SummarizationError(String),
19
20 #[error("Storage error: {0}")]
21 StorageError(String),
22
23 #[error("LLM error: {0}")]
24 LlmError(String),
25
26 #[error("Fact extraction error: {0}")]
27 FactExtractionError(String),
28
29 #[error("Graph database query failed: {0}")]
30 GraphDatabaseError(String),
31
32 #[error("Failed to store graph: {0}")]
33 GraphStorageError(String),
34
35 #[error("Embedding generation error: {0}")]
36 EmbeddingError(String),
37
38 #[error("Vector database error: {0}")]
39 VectorDBError(String),
40
41 #[error("Dataset resolution error: {0}")]
42 DatasetResolutionError(String),
43
44 #[error("Database error: {0}")]
45 DatabaseError(String),
46
47 #[error("Serialization error: {0}")]
48 SerializationError(String),
49
50 #[error("Unsupported document type: {0}")]
51 UnsupportedDocumentType(String),
52
53 #[error("Task context build failed: {0}")]
54 ContextBuild(String),
55
56 #[error("Pipeline execution failed: {0}")]
57 Execute(String),
58
59 #[error("Output type mismatch: expected {expected}, got {actual}")]
60 OutputTypeMismatch {
61 expected: &'static str,
62 actual: &'static str,
63 },
64
65 #[error("pipeline {pipeline_name} for dataset {dataset_id} is already running")]
74 PipelineAlreadyRunning {
75 pipeline_name: String,
76 dataset_id: Uuid,
77 },
78}
79
80impl From<cognee_graph::GraphDBError> for CognifyError {
82 fn from(err: cognee_graph::GraphDBError) -> Self {
83 CognifyError::GraphDatabaseError(err.to_string())
84 }
85}
86
87impl From<cognee_database::DatabaseError> for CognifyError {
89 fn from(err: cognee_database::DatabaseError) -> Self {
90 CognifyError::DatabaseError(err.to_string())
91 }
92}