playground_api/error.rs
1use thiserror::Error;
2
3/// Represents all possible errors that can occur while interacting with the Rust playground API.
4#[derive(Error, Debug)]
5pub enum Error {
6 /// An error originating from the `reqwest` HTTP client.
7 ///
8 /// This may include network failures, timeout errors, or unexpected HTTP behavior.
9 #[error("reqwest error: {0}")]
10 ReqWest(#[from] reqwest::Error),
11
12 /// An error occurred while parsing a URL.
13 ///
14 /// Typically triggered when constructing or joining a malformed URL.
15 #[error("url parse error: {0}")]
16 Url(#[from] url::ParseError),
17
18 /// The HTTP response status code was not in the 2xx success range.
19 ///
20 /// Contains the numeric status code of the failed response.
21 #[error("request status code was not successful: {0}")]
22 NoSuccess(u16),
23}