1use thiserror::Error;
4
5#[derive(Debug, Error)]
7#[non_exhaustive]
8pub enum DispatchError {
9 #[error("invalid JSON in --json argument")]
10 InvalidJsonBody(#[source] serde_json::Error),
11
12 #[error("invalid --field format: {field} (expected key=value)")]
13 InvalidFieldFormat { field: String },
14
15 #[error("request body is required (use --json or --field)")]
16 BodyRequired,
17
18 #[error("unsupported HTTP method: {method}")]
19 UnsupportedMethod { method: String },
20
21 #[error("HTTP request failed")]
22 RequestFailed(#[source] reqwest::Error),
23
24 #[error("failed to read response body")]
25 ResponseRead(#[source] reqwest::Error),
26
27 #[error("HTTP {status}: {body}")]
28 HttpError {
29 status: reqwest::StatusCode,
30 body: String,
31 },
32}