redmine_api/
lib.rs

1#![deny(unknown_lints)]
2#![deny(renamed_and_removed_lints)]
3#![forbid(unsafe_code)]
4#![deny(deprecated)]
5#![forbid(private_interfaces)]
6#![forbid(private_bounds)]
7#![forbid(non_fmt_panics)]
8#![deny(unreachable_code)]
9#![deny(unreachable_patterns)]
10#![forbid(unused_doc_comments)]
11#![forbid(unused_must_use)]
12#![deny(while_true)]
13#![deny(unused_parens)]
14#![deny(redundant_semicolons)]
15#![deny(non_ascii_idents)]
16#![deny(confusable_idents)]
17#![warn(missing_docs)]
18#![warn(clippy::missing_docs_in_private_items)]
19#![warn(clippy::cargo_common_metadata)]
20#![warn(rustdoc::missing_crate_level_docs)]
21#![deny(rustdoc::broken_intra_doc_links)]
22#![warn(missing_debug_implementations)]
23#![deny(clippy::mod_module_files)]
24//#![warn(clippy::pedantic)]
25#![warn(clippy::redundant_else)]
26#![warn(clippy::must_use_candidate)]
27#![warn(clippy::missing_panics_doc)]
28#![warn(clippy::missing_errors_doc)]
29#![doc = include_str!("../README.md")]
30
31pub mod api;
32
33use thiserror::Error;
34
35/// Error type for redmine_api
36#[derive(Debug, Error)]
37pub enum Error {
38    /// An error occurred in the reqwest library (HTTP)
39    #[error("reqwest error: {0}")]
40    ReqwestError(#[from] reqwest::Error),
41    /// An error occurred when serializing/deserializing JSON
42    #[error("error in json serialization/deserialization: {0}")]
43    SerdeJsonError(#[from] serde_json::Error),
44    /// An error occurred when parsing a URL
45    #[error("error when parsing URL: {0}")]
46    UrlParseError(#[from] url::ParseError),
47    /// An error occurred when reading configuration from environment variables
48    #[error("error when reading environment variables: {0}")]
49    EnvyError(#[from] envy::Error),
50    /// Response body was empty so we can not deserialize it as JSON
51    #[error("empty response body with status: {0}")]
52    EmptyResponseBody(reqwest::StatusCode),
53    /// Response body was valid JSON but not an object
54    #[error("JSON but non-object response body with status: {0}")]
55    NonObjectResponseBody(reqwest::StatusCode),
56    /// Missing response pagination key (total_counts, offset, limit or the wrapper key)
57    #[error("JSON wrapper pagination key missing: {0}")]
58    PaginationKeyMissing(String),
59    /// Response pagination key has the wrong type (total_counts, offset, limit)
60    #[error("JSON wrapper pagination key has an unexpected type: {0}")]
61    PaginationKeyHasWrongType(String),
62    /// Parsing a time string to a time object (OffsetDateTime) failed
63    #[error("Parsing string {0} to time object failed")]
64    TimeParseError(String, time::error::Parse),
65    /// Error reading a file we are supposed to upload
66    #[error("Error when opening or reading file {0} to upload: {1}")]
67    UploadFileError(std::path::PathBuf, std::io::Error),
68}