mirror of
https://github.com/perstarkse/minne.git
synced 2026-06-30 18:11:34 +02:00
1e0dba72c8
Run FastEmbed inference on spawn_blocking, propagate Surreal take failures, add AppError::internal and typed ingest/embedding parse errors, and take owned file lists in ingestion payload construction.
50 lines
1.5 KiB
Rust
50 lines
1.5 KiB
Rust
use async_openai::error::OpenAIError;
|
|
use thiserror::Error;
|
|
use tokio::task::JoinError;
|
|
|
|
use crate::storage::types::file_info::FileError;
|
|
|
|
// Core internal errors
|
|
#[allow(clippy::module_name_repetitions)]
|
|
#[derive(Error, Debug)]
|
|
pub enum AppError {
|
|
#[error("database error: {0}")]
|
|
Database(#[from] surrealdb::Error),
|
|
#[error("openai error: {0}")]
|
|
OpenAI(#[from] OpenAIError),
|
|
#[error("file error: {0}")]
|
|
File(#[from] FileError),
|
|
#[error("not found: {0}")]
|
|
NotFound(String),
|
|
#[error("validation error: {0}")]
|
|
Validation(String),
|
|
#[error("authorization error: {0}")]
|
|
Auth(String),
|
|
#[error("llm parsing error: {0}")]
|
|
LLMParsing(String),
|
|
#[error("task join error: {0}")]
|
|
Join(#[from] JoinError),
|
|
#[error("graph mapper error: {0}")]
|
|
GraphMapper(String),
|
|
#[error("io error: {0}")]
|
|
Io(#[from] std::io::Error),
|
|
#[error("reqwest error: {0}")]
|
|
Reqwest(#[from] reqwest::Error),
|
|
#[error("storage error: {0}")]
|
|
Storage(#[from] object_store::Error),
|
|
#[error("ingestion processing error: {0}")]
|
|
Processing(String),
|
|
#[error("dom smoothie error: {0}")]
|
|
DomSmoothie(#[from] dom_smoothie::ReadabilityError),
|
|
#[error("internal service error: {0}")]
|
|
InternalError(String),
|
|
}
|
|
|
|
impl AppError {
|
|
/// Builds an [`AppError::InternalError`] from a displayable message.
|
|
#[must_use]
|
|
pub fn internal(msg: impl std::fmt::Display) -> Self {
|
|
Self::InternalError(msg.to_string())
|
|
}
|
|
}
|