Fixed error serialization
ci/woodpecker/push/ociImagePush Pipeline was successful Details

This commit is contained in:
Natty 2024-11-17 04:25:30 +01:00
parent 0a23953ae9
commit 11ff0ad2c0
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
1 changed files with 11 additions and 9 deletions

View File

@ -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<reqwest::Error> 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(),
}
}
}