Skip to main content

argyph_embed/
error.rs

1use std::time::Duration;
2use thiserror::Error;
3
4#[derive(Debug, Error)]
5pub enum EmbedError {
6    #[error("HTTP error: {0}")]
7    Http(String),
8
9    #[error("rate limited, retry after {retry_after:?}")]
10    RateLimited { retry_after: Option<Duration> },
11
12    #[error("authentication failed: {0}")]
13    Auth(String),
14
15    #[error("invalid response: {0}")]
16    InvalidResponse(String),
17
18    #[error("batch too large: {batch_size}, max: {max_batch_size}")]
19    BatchTooLarge {
20        batch_size: usize,
21        max_batch_size: usize,
22    },
23
24    #[error("empty input")]
25    EmptyInput,
26
27    #[error("configuration error: {0}")]
28    Config(String),
29}
30
31pub type Result<T> = std::result::Result<T, EmbedError>;