Skip to content

Commit 58bea9f

Browse files
authored
Expose underlying error when peer_connect attestation fails (#46)
### TL;DR Improved error logging for attestation creation failures in the ChatterServer. a the attestation creation code in the `ChatterService` implementation to use a match statement instead of an if-let pattern. This change allows for capturing and logging the specific error that occurs during attestation creation, rather than just logging a generic error message. ### How to test? 1. Run a Lit node in an environment where attestation creation might fail 2. Check the logs for more detailed error messages that now include the specific error information 3. Verify that the error message format is now `"Error creating attestation: {:?}"` with the actual error details ### Why make this change? This change enhances debugging capabilities by providing more detailed error information when attestation creation fails. Having the specific error details in the logs will make it easier to diagnose and fix issues related to attestation creation in production environments.
2 parents 14cc553 + 80ddcf7 commit 58bea9f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

rust/lit-node/lit-node/src/p2p_comms/web/chatter_server.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,14 @@ impl ChatterService for ChatterServer {
198198
version: version::get_version().to_string(),
199199
};
200200

201-
if let Ok(at) = create_attestation(cfg.load_full(), &noonce, None).await {
202-
peer_item.attestation = Some(at);
203-
} else {
204-
#[cfg(not(feature = "testing"))]
205-
error!("Error creating attestation.");
201+
match create_attestation(cfg.load_full(), &noonce, None).await {
202+
Ok(at) => {
203+
peer_item.attestation = Some(at);
204+
}
205+
Err(e) => {
206+
#[cfg(not(feature = "testing"))]
207+
error!("Error creating attestation: {:?}", e);
208+
}
206209
}
207210

208211
let peer_item_json = match serde_json::to_string(&peer_item) {

0 commit comments

Comments
 (0)