#[derive(thiserror::Error, Debug)]
pub enum ApiError {
#[error(
"You are trying to send too many requests to the API in to short an interval. Slow down a \
bit, otherwise these error will persist. Sorry for this, but we try to prevent DOS attacks."
)]
TooManyRequests,
#[error(
"Sorry the request to the Aleph Alpha API has been rejected due to the requested model \
being very busy at the moment. We found it unlikely that your request would finish in a \
reasonable timeframe, so it was rejected right away, rather than make you wait. You are \
welcome to retry your request any time."
)]
Busy,
#[error("HTTP request failed with status code {}. Body:\n{}", status, body)]
Http { status: u16, body: String },
#[error(transparent)]
Client(#[from] reqwest::Error),
#[error(transparent)]
Tokenizer(#[from] tokenizers::Error),
}