Skip to content

Commit ccfd498

Browse files
Don't print inner error when returning as source
According to rust-lang/project-error-handling#44 (comment), we should not be printing the inner error AND returning it as source. Libraries like `anyhow` will traverse the chain of `source` errors and build up a composed error message. Printing it and returning the same error from `source` results in duplicate error messages in that case.
1 parent b185946 commit ccfd498

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/src/transport.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ where
393393
TransportError::MultiaddrNotSupported(addr) => {
394394
write!(f, "Multiaddr is not supported: {}", addr)
395395
}
396-
TransportError::Other(err) => write!(f, "{}", err),
396+
TransportError::Other(_) => Ok(()),
397397
}
398398
}
399399
}

0 commit comments

Comments
 (0)