Annotate Api::Problem error with thiserror::transparent

Error variant `Api::Problem` prints "API error: {problem}" however the Problem struct has display impl that starts by printing "API error". Together this results in "API error: API error" followed by the details.

This fixes that by annotating `Api::Problem` with `thiserror`'s `transparent` attribute which forwards the display impl to the underlying types display impl.
This commit is contained in:
David Kleingeld 2023-04-23 12:39:55 +02:00 committed by Dirkjan Ochtman
parent f0a2b4ef36
commit 1a9ce194b7
1 changed files with 1 additions and 1 deletions

View File

@ -15,7 +15,7 @@ pub enum Error {
/// An JSON problem as returned by the ACME server
///
/// RFC 8555 uses problem documents as described in RFC 7807.
#[error("API error: {0}")]
#[error(transparent)]
Api(#[from] Problem),
/// Failed to base64-decode data
#[error("base64 decoding failed: {0}")]