arduino_report_size_deltas/
error.rs

1use thiserror::Error;
2
3/// The possible error types related to parsing JSON data.
4#[derive(Debug, Error)]
5pub enum JsonError {
6    /// Errors emitted from (de)serializing JSON data.
7    #[error("{0}")]
8    Serde(#[from] serde_json::Error),
9
10    /// Error emitted when failing to read a JSON file.
11    #[error("{0:?}")]
12    FileReadFail(#[from] std::io::Error),
13}
14
15/// The types of error that could be propagated from [`generate_comment()`][fn@crate::summarize::generate_comment].
16#[derive(Debug, Error)]
17pub enum CommentAssemblyError {
18    /// Represents any [`std::io::Error`] encountered.
19    #[error("{0:?}")]
20    Io(#[from] std::io::Error),
21
22    /// Represents any [`JsonError`] encountered.
23    #[error("{0:?}")]
24    Json(#[from] JsonError),
25
26    /// Represents an error in which expected data is not found.
27    ///
28    /// Check stderr for the root cause of this kind of error because
29    /// detailed log output is emitted in this situation.
30    #[error("Found no applicable data to summarize")]
31    NotFound,
32}