Skip to content

Commit cdbd48d

Browse files
authored
Merge pull request #981 from openmina/fix/action-error-logging
fix: Better logging of p2p action errors
2 parents 5d55383 + fcfbfd4 commit cdbd48d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

node/src/reducer.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,23 @@ pub fn reducer(
3434
}
3535
dispatcher.push(P2pEffectfulAction::Initialize);
3636
}
37-
action => match &mut state.p2p {
37+
p2p_action => match &mut state.p2p {
3838
P2p::Pending(_) => {
39-
error!(meta.time(); summary = "p2p is not initialized", action = debug(action))
39+
error!(meta.time(); summary = "p2p is not initialized", action = debug(p2p_action))
4040
}
4141
P2p::Ready(_) => {
4242
let time = meta.time();
4343
let result = p2p::P2pState::reducer(
4444
Substate::new(state, dispatcher),
45-
meta.with_action(action.clone()),
45+
meta.with_action(p2p_action.clone()),
4646
);
4747

4848
if let Err(error) = result {
49-
error!(time; error = display(error));
49+
use crate::ActionKindGet as _;
50+
error!(time;
51+
summary = "Failure when handling a P2P action",
52+
action_kind = format!("{}", p2p_action.kind()),
53+
error = display(error));
5054
}
5155
}
5256
},

0 commit comments

Comments
 (0)