1use subtp::ParseError;
2
3use crate::ApiError;
4use crate::ClientError;
5
6#[derive(Debug, thiserror::Error)]
8pub enum AudioApiError {
9 #[error("Client error: {0:?}")]
11 ClientError(#[from] ClientError),
12 #[error("API error: {0:?}")]
14 ApiError(#[from] ApiError),
15 #[error("Failed to format response text of audio API: {0:?}")]
17 FormatResponseFailed(#[from] TextFormatError),
18 #[error("Stream option mismatch, this is only available for verbose_json response format.")]
20 TimestampOptionMismatch,
21}
22
23#[derive(Debug, thiserror::Error)]
25pub enum TextFormatError {
26 #[error("Failed to format into JSON: {error:?}, {text}")]
28 FormatJsonFailed {
29 error: serde_json::Error,
31 text: String,
33 },
34 #[error("Failed to parse into SubRip Subtitle format: {error:?}, {text}")]
36 ParseSrtFailed {
37 error: ParseError,
39 text: String,
41 },
42 #[error("Failed to parse into WebVTT format: {error:?}, {text}")]
44 ParseVttFailed {
45 error: ParseError,
47 text: String,
49 },
50}