openai_interface/
errors.rs1use std::path::PathBuf;
2
3use thiserror::Error;
4
5#[derive(Debug, Error)]
6pub enum OapiError {
7 #[error("Failed to send request: {0}")]
8 SendError(String),
9 #[error("Response error: {0}")]
10 ResponseError(String),
11 #[error("Invalid response code: {0}")]
12 ResponseCode(u16),
13 #[error("Invalid response status: {0}")]
14 ResponseStatus(u16),
15 #[error("Failed to parse to String: {0}")]
16 SseParseError(String),
17 #[error("{0}")]
18 StreamError(String),
19 #[error("You cannot post a streaming request in a non-streaming context")]
21 NonStreamingViolation,
22 #[error("You cannot post a non-streaming request in a streaming context")]
24 StreamingViolation,
25 #[error("Deserialization error:\n{0}\n\nPlease report this error in the project issue.")]
26 DeserializationError(String),
27 #[error("File not found at: {0}")]
28 FileNotFoundError(PathBuf),
29 #[error("Failed to read file: {0}")]
30 FileReadError(std::io::Error),
31
32 #[error("Not implemented")]
33 NotImplemented,
34}