Chore/more error macros (#2686)

* cleaned up MixProcessingError

* Added Error impl to (hopefully) all error enums in the codebase

* Replaced all occurences of error("{0}") with error(transparent)

* Changelog entry
This commit is contained in:
Jędrzej Stuczyński
2022-12-13 17:42:11 +00:00
committed by GitHub
parent a020f2ad1c
commit 97b01db23e
94 changed files with 583 additions and 714 deletions
@@ -58,7 +58,7 @@ impl ConnectionHandler {
// all processing such, key caching, etc. was done.
// however, if it was a forward hop, we still need to delay it
match self.packet_processor.process_received(framed_sphinx_packet) {
Err(e) => debug!("We failed to process received sphinx packet - {:?}", e),
Err(err) => debug!("We failed to process received sphinx packet - {err}"),
Ok(res) => match res {
MixProcessingResult::ForwardHop(forward_packet, delay) => {
self.delay_and_forward_packet(forward_packet, delay)
+2 -2
View File
@@ -27,7 +27,7 @@ impl Listener {
let listener = match TcpListener::bind(self.address).await {
Ok(listener) => listener,
Err(err) => {
error!("Failed to bind to {} - {}. Are you sure nothing else is running on the specified port and your user has sufficient permission to bind to the requested address?", self.address, err);
error!("Failed to bind to {} - {err}. Are you sure nothing else is running on the specified port and your user has sufficient permission to bind to the requested address?", self.address);
process::exit(1);
}
};
@@ -40,7 +40,7 @@ impl Listener {
let handler = connection_handler.clone();
tokio::spawn(handler.handle_connection(socket, remote_addr, self.shutdown.clone()));
}
Err(err) => warn!("Failed to accept incoming connection - {:?}", err),
Err(err) => warn!("Failed to accept incoming connection - {err}"),
}
},
_ = self.shutdown.recv() => {