aleph_alpha_api/
error.rs

1#[derive(thiserror::Error, Debug)]
2pub enum ApiError {
3    /// User exceeds his current Task Quota.
4    #[error(
5        "You are trying to send too many requests to the API in to short an interval. Slow down a \
6        bit, otherwise these error will persist. Sorry for this, but we try to prevent DOS attacks."
7    )]
8    TooManyRequests,
9    /// Model is busy. Most likely due to many other users requesting its services right now.
10    #[error(
11        "Sorry the request to the Aleph Alpha API has been rejected due to the requested model \
12        being very busy at the moment. We found it unlikely that your request would finish in a \
13        reasonable timeframe, so it was rejected right away, rather than make you wait. You are \
14        welcome to retry your request any time."
15    )]
16    Busy,
17    /// An error on the Http Protocol level.
18    #[error("HTTP request failed with status code {}. Body:\n{}", status, body)]
19    Http { status: u16, body: String },
20    /// Most likely either TLS errors creating the Client, or IO errors.
21    #[error(transparent)]
22    Client(#[from] reqwest::Error),
23
24    #[error(transparent)]
25    Tokenizer(#[from] tokenizers::Error),
26}