Skip to main content

anyllm_batch_engine/
error.rs

1// crates/batch_engine/src/error.rs
2//! Engine and queue error types.
3
4use thiserror::Error;
5
6/// Top-level error type returned by `BatchEngine` operations.
7#[derive(Debug, Error)]
8pub enum EngineError {
9    #[error("batch not found: {0}")]
10    NotFound(String),
11
12    #[error("file not found: {0}")]
13    FileNotFound(String),
14
15    #[error("validation error: {0}")]
16    Validation(String),
17
18    #[error("queue error: {0}")]
19    Queue(#[from] QueueError),
20
21    #[error("backend error: {0}")]
22    Backend(String),
23}
24
25/// Storage-layer errors returned by `JobQueue` and `WebhookQueue` implementations.
26#[derive(Debug, Error)]
27pub enum QueueError {
28    #[error("not found")]
29    NotFound,
30
31    #[error("already claimed")]
32    AlreadyClaimed,
33
34    #[error("storage error: {0}")]
35    Storage(String),
36}
37
38impl From<rusqlite::Error> for QueueError {
39    fn from(e: rusqlite::Error) -> Self {
40        QueueError::Storage(e.to_string())
41    }
42}