edc_connector_client/
error.rs1use reqwest::StatusCode;
2use serde::Deserialize;
3
4#[derive(Debug, thiserror::Error)]
5pub enum Error {
6 #[error(transparent)]
7 Reqwest(#[from] reqwest::Error),
8
9 #[error(transparent)]
10 ManagementApi(ManagementApiError),
11}
12
13#[derive(Debug, thiserror::Error)]
14#[error("Connector management api returned {status_code}")]
15pub struct ManagementApiError {
16 pub status_code: StatusCode,
17 pub error_detail: ManagementApiErrorDetailKind,
18}
19
20#[derive(Debug, Deserialize)]
21pub struct ManagementApiErrorDetail {
22 pub message: String,
23 #[serde(rename = "type")]
24 pub kind: String,
25}
26
27#[derive(Debug)]
28pub enum ManagementApiErrorDetailKind {
29 Raw(String),
30 Parsed(Vec<ManagementApiErrorDetail>),
31}
32
33#[derive(Debug, thiserror::Error)]
34pub enum BuilderError {
35 #[error("Missing mandatory property {0}")]
36 MissingProperty(String),
37}
38
39impl BuilderError {
40 pub fn missing_property(property: &str) -> BuilderError {
41 BuilderError::MissingProperty(property.to_string())
42 }
43}
44
45#[derive(Debug, thiserror::Error, PartialEq)]
46#[error("Failed to convert")]
47pub struct ConversionError {}