git_bot_feedback/
error.rs

1use thiserror::Error;
2
3use crate::OutputVariable;
4
5/// The possible error emitted by the REST client API
6#[derive(Debug, Error)]
7pub enum RestClientError {
8    /// Error related to making HTTP requests
9    #[error("{0}")]
10    Request(#[from] reqwest::Error),
11
12    /// Errors related to standard I/O.
13    #[error("{0}")]
14    Io(#[from] std::io::Error),
15
16    /// Error related to exceeding REST API Rate limits
17    #[error("Rate Limit exceeded")]
18    RateLimit,
19
20    /// Error emitted when cloning a request object fails.
21    #[error("Failed to clone request object for auto-reties")]
22    RequestCloneError,
23
24    /// Error emitted when creating header value fails.
25    #[error("Tried to create a header value from invalid string data")]
26    InvalidHeaderValue(#[from] reqwest::header::InvalidHeaderValue),
27
28    /// Error emitted when parsing a URL fails.
29    #[error("{0}")]
30    UrlParseError(#[from] url::ParseError),
31
32    /// Error emitted when deserializing/serializing request/response JSON data.
33    #[error("{0}")]
34    JsonError(#[from] serde_json::Error),
35
36    /// Error emitted when failing to read environment variable
37    #[error("{0}")]
38    EnvVarError(#[from] std::env::VarError),
39
40    /// An error emitted when encountering an invalid [`OutputVariable`].
41    #[error("OutputVariable is malformed: {0}")]
42    OutputVarError(OutputVariable),
43}