diff --git a/src/model/activity/delivery.rs b/src/model/activity/delivery.rs index abb4710..431a3bd 100644 --- a/src/model/activity/delivery.rs +++ b/src/model/activity/delivery.rs @@ -17,7 +17,7 @@ pub enum DeliveryErrorClass { #[derive(Debug, Error, Serialize)] #[error("Invalid delivery task definition: {}")] -#[serde(tag = "type")] +#[serde(tag = "type", content = "detail")] pub enum InvalidDeliveryTaskError { #[error("No signer with ID: {0}")] NoSuchSigner(String), @@ -33,7 +33,7 @@ pub enum InvalidDeliveryTaskError { #[derive(Debug, Error, Serialize)] #[error("Retriable task delivery failure: {}")] -#[serde(tag = "type")] +#[serde(tag = "type", content = "detail")] pub enum RetriableLocalDeliveryTaskError { #[error("Signing error: {0}")] Signing(String), @@ -45,7 +45,7 @@ pub enum RetriableLocalDeliveryTaskError { #[derive(Debug, Error, Serialize)] #[error("Retriable remote delivery error: {}")] -#[serde(tag = "type")] +#[serde(tag = "type", content = "detail")] pub enum RetriableRemoteDeliveryError { #[error("Timeout")] Timeout, @@ -75,7 +75,7 @@ pub enum RetriableRemoteDeliveryError { #[derive(Debug, Error, Serialize)] #[error("Hard remote delivery error: {}")] -#[serde(tag = "type")] +#[serde(tag = "type", content = "detail")] pub enum HardRemoteDeliveryError { #[error("Gone")] Gone, @@ -98,7 +98,7 @@ pub struct DeliveryError { } #[derive(Debug, Error, Serialize)] -#[serde(tag = "type")] +#[serde(tag = "type", content = "detail")] pub enum DeliveryErrorKind { #[error(transparent)] InvalidTask(#[from] InvalidDeliveryTaskError), @@ -231,11 +231,13 @@ impl From for DeliveryErrorKind { } match value { - e if e.is_connect() => RetriableRemoteDeliveryError::Connect(e.to_string()).into(), + e if e.is_connect() => RetriableRemoteDeliveryError::Connect(format!("{:?}", e)).into(), e if e.is_timeout() => RetriableRemoteDeliveryError::Timeout.into(), - e if e.is_decode() => RetriableRemoteDeliveryError::ResponseParse(e.to_string()).into(), - e if e.is_builder() => InvalidDeliveryTaskError::Reqwest(e.to_string()).into(), - e => RetriableRemoteDeliveryError::GenericReqwest(e.to_string()).into(), + e if e.is_decode() => { + RetriableRemoteDeliveryError::ResponseParse(format!("{:?}", e)).into() + } + e if e.is_builder() => InvalidDeliveryTaskError::Reqwest(format!("{:?}", e)).into(), + e => RetriableRemoteDeliveryError::GenericReqwest(format!("{:?}", e)).into(), } } }