1use thiserror::Error;
2
3pub type ApiResult<T> = Result<T, Error>;
4
5#[derive(Debug, Error)]
6pub enum Error {
7 #[error("Failed to send request: `{0}`")]
8 RequestFailed(String),
9 #[error("Failed to parse response: `{0}`")]
10 ParseError(String),
11 #[error("Bad request, something was wrong with your request.")]
12 BadRequest,
13 #[error("Unauthorized, please check your API key.")]
14 Unauthorized,
15 #[error("Too many requests, please wait a bit before trying again.")]
16 TooManyRequests,
17 #[error("Internal server error, please try again later.")]
18 InternalServerError,
19 #[error("Unknown error: `{0}`")]
20 Unknown(u16),
21 #[error("TTS job failed: `{0}`")]
22 JobFailed(String),
23}