From 45582a0ec471bf053ce9b7c08e25ef418c18b73b Mon Sep 17 00:00:00 2001 From: Joonas Koivunen Date: Wed, 6 Sep 2023 17:10:11 +0300 Subject: [PATCH] DownloadError: align Display with anyhow impl --- libs/remote_storage/src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/remote_storage/src/lib.rs b/libs/remote_storage/src/lib.rs index f329a1a537..a44d7dd5c2 100644 --- a/libs/remote_storage/src/lib.rs +++ b/libs/remote_storage/src/lib.rs @@ -208,7 +208,14 @@ impl std::fmt::Display for DownloadError { write!(f, "Failed to download a remote file due to user input: {e}") } DownloadError::NotFound => write!(f, "No file found for the remote object id given"), - DownloadError::Other(e) => write!(f, "Failed to download a remote file: {e:?}"), + DownloadError::Other(e) => { + write!(f, "Failed to download a remote file: ")?; + if f.alternate() { + write!(f, "{e:#}") + } else { + write!(f, "{e}") + } + } } } }