wekan_cli/client/
error.rs1use reqwest::StatusCode;
2use thiserror::Error;
3
4#[derive(Debug, Error)]
5pub enum ClientError {
6 #[error("the resource lookup returned an empty HTTP {http_status} response")]
7 EmptyNotFound { http_status: StatusCode },
8 #[error("failed to initialize the HTTP client")]
9 Build(#[source] reqwest::Error),
10 #[error("the request could not be completed")]
11 Transport(#[source] reqwest::Error),
12 #[error("the server returned an unexpected redirect ({status})")]
13 UnexpectedRedirect { status: StatusCode },
14 #[error("the server response exceeded the {limit_bytes}-byte limit")]
15 ResponseTooLarge {
16 limit_bytes: usize,
17 status: StatusCode,
18 retry_after_seconds: Option<u64>,
19 },
20 #[error("the server response body could not be read")]
21 ResponseBody {
22 status: StatusCode,
23 retry_after_seconds: Option<u64>,
24 #[source]
25 source: reqwest::Error,
26 },
27 #[error("the server returned an invalid response: {message}")]
28 Protocol {
29 message: String,
30 diagnostic: Option<super::ResponseDiagnostic>,
31 success_status_received: bool,
32 },
33 #[error(
34 "the Wekan server returned an embedded error without statusCode in an HTTP {http_status} response"
35 )]
36 EmbeddedProtocol {
37 http_status: StatusCode,
38 server_error: Option<String>,
39 server_reason: Option<String>,
40 server_message: Option<String>,
41 server_error_type: Option<String>,
42 server_is_client_safe: Option<bool>,
43 },
44 #[error("the Wekan server returned an error ({status})")]
45 Server {
46 status: StatusCode,
47 server_error: Option<String>,
48 server_reason: Option<String>,
49 retry_after_seconds: Option<u64>,
50 },
51 #[error(
52 "the Wekan server returned an embedded error ({wekan_status_code}) in an HTTP {http_status} response"
53 )]
54 EmbeddedServer {
55 http_status: StatusCode,
56 wekan_status_code: u16,
57 server_error: Option<String>,
58 server_reason: Option<String>,
59 },
60}