Disable issue URLs for "duplicate hash" errors (#1517)

In our README, we tell users to ignore these errors, so we should also
disable the issue URL.

Also include the hash in the error. (We don't want the span active for
all messages, we just want the hash in the error.)
This commit is contained in:
teor 2020-12-16 08:14:42 +10:00 committed by GitHub
parent 008577561c
commit 69fcf64d6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -161,9 +161,15 @@ impl Application for ZebradApp {
.issue_filter(|kind| match kind {
color_eyre::ErrorKind::NonRecoverable(_) => true,
color_eyre::ErrorKind::Recoverable(error) => {
!error.is::<tower::timeout::error::Elapsed>()
&& !error.is::<tokio::time::error::Elapsed>()
&& !error.to_string().contains("timed out")
// type checks should be faster than string conversions
if error.is::<tower::timeout::error::Elapsed>()
|| error.is::<tokio::time::error::Elapsed>()
{
return false;
}
let error_str = error.to_string();
!error_str.contains("timed out") && !error_str.contains("duplicate hash")
}
});

View File

@ -113,7 +113,7 @@ where
#[instrument(level = "debug", skip(self), fields(%hash))]
pub async fn download_and_verify(&mut self, hash: block::Hash) -> Result<(), Report> {
if self.cancel_handles.contains_key(&hash) {
return Err(eyre!("duplicate hash queued for download"));
return Err(eyre!("duplicate hash queued for download: {:?}", hash));
}
// We construct the block requests sequentially, waiting for the peer