replicate_rust/errors.rs
1//! Custom errors for the crate.
2
3use thiserror::Error;
4
5/// Errors related to sending requests to the API.
6#[derive(Error, Debug)]
7pub enum ReplicateError {
8 /// Error occues when sending the api request results in an error.
9 #[error("failed to send the api request: {0}")]
10 ReqwestError(#[from] reqwest::Error),
11
12 /// Error occues when the api returns a non 200 response.
13 #[error("Received a non 200 response from the api: {0}")]
14 ResponseError(String),
15
16 /// Error occues when parsing the api response into a struct results in an error.
17 #[error("failed to parse the api response : {0}")]
18 SerdeError(#[from] serde_json::Error),
19
20 /// Invalid version string provided.
21 #[error("Invalid version string: {0}")]
22 InvalidVersionString(String),
23}