1#[derive(thiserror::Error, Debug)]
2pub enum ApiError {
3 #[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 #[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 #[error("HTTP request failed with status code {}. Body:\n{}", status, body)]
19 Http { status: u16, body: String },
20 #[error(transparent)]
22 Client(#[from] reqwest::Error),
23
24 #[error(transparent)]
25 Tokenizer(#[from] tokenizers::Error),
26}