added: more error variants

This commit is contained in:
2023-03-10 10:45:07 +01:00
parent e696663aec
commit 2688c81aed
2 changed files with 7 additions and 2 deletions

View File

@@ -21,7 +21,7 @@ where
.context("failed to extract body")?;
let cert = Certificate::from_openssh(&body)
.with_context(|| format!("failed to parse '{}'", body))?;
.with_context(|| format!("failed to parse '{}'", body)).map_err(ApiError::ParseCertificate)?;
trace!(%body, "extracted certificate");
Ok(Self(cert))
}
@@ -42,7 +42,7 @@ where
.await
.context("failed to extract body")?;
let sig = SshSig::from_pem(&body).with_context(|| format!("failed to parse '{}'", body))?;
let sig = SshSig::from_pem(&body).with_context(|| format!("failed to parse '{}'", body)).map_err(ApiError::ParseSignature)?;
trace!(%body, "extracted signature");
Ok(Self(sig))
}