mirror of
https://github.com/perstarkse/minne.git
synced 2026-05-28 10:29:30 +02:00
chore: removed anyhow from apperror for improved error handling
This commit is contained in:
+3
-3
@@ -26,12 +26,12 @@ pub enum AppError {
|
||||
Join(#[from] JoinError),
|
||||
#[error("Graph mapper error: {0}")]
|
||||
GraphMapper(String),
|
||||
#[error("IoError: {0}")]
|
||||
#[error("IO error: {0}")]
|
||||
Io(#[from] std::io::Error),
|
||||
#[error("Reqwest error: {0}")]
|
||||
Reqwest(#[from] reqwest::Error),
|
||||
#[error("Anyhow error: {0}")]
|
||||
Anyhow(#[from] anyhow::Error),
|
||||
#[error("Storage error: {0}")]
|
||||
Storage(#[from] object_store::Error),
|
||||
#[error("Ingestion Processing error: {0}")]
|
||||
Processing(String),
|
||||
#[error("DOM smoothie error: {0}")]
|
||||
|
||||
@@ -253,11 +253,11 @@ impl FileInfo {
|
||||
|
||||
// Remove the object's parent prefix in the object store
|
||||
let (parent_prefix, _file_name) = store::split_object_path(&file_info.path)
|
||||
.map_err(|e| AppError::from(anyhow::anyhow!(e)))?;
|
||||
.map_err(|e| AppError::InternalError(e.to_string()))?;
|
||||
storage
|
||||
.delete_prefix(&parent_prefix)
|
||||
.await
|
||||
.map_err(|e| AppError::from(anyhow::anyhow!(e)))?;
|
||||
.map_err(AppError::Storage)?;
|
||||
info!(
|
||||
"Removed object prefix {} and its contents via StorageManager",
|
||||
parent_prefix
|
||||
@@ -283,7 +283,7 @@ impl FileInfo {
|
||||
storage
|
||||
.get(&self.path)
|
||||
.await
|
||||
.map_err(|e: object_store::Error| AppError::from(anyhow::anyhow!(e)))
|
||||
.map_err(AppError::Storage)
|
||||
}
|
||||
|
||||
/// Persist file to storage using StorageManager.
|
||||
|
||||
@@ -311,7 +311,7 @@ pub async fn generate_embedding_with_provider(
|
||||
provider: &EmbeddingProvider,
|
||||
input: &str,
|
||||
) -> Result<Vec<f32>, AppError> {
|
||||
provider.embed(input).await.map_err(AppError::from)
|
||||
provider.embed(input).await.map_err(|e| AppError::InternalError(e.to_string()))
|
||||
}
|
||||
|
||||
/// Generates an embedding vector for the given input text using `OpenAI`'s embedding model.
|
||||
|
||||
Reference in New Issue
Block a user