From 1a9ce194b7a0415ba5021084057250061ead4436 Mon Sep 17 00:00:00 2001 From: David Kleingeld Date: Sun, 23 Apr 2023 12:39:55 +0200 Subject: [PATCH] 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. --- src/types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types.rs b/src/types.rs index 43fe7ad..5401bc8 100644 --- a/src/types.rs +++ b/src/types.rs @@ -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}")]