From 83ff547e695cf85d85eb7b37d330a2875d9fcf03 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 10 Jan 2021 21:49:51 +0000 Subject: [PATCH] mgmtchanne: More helpfully report errors from AlterGame insns Signed-off-by: Ian Jackson --- src/mgmtchannel.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mgmtchannel.rs b/src/mgmtchannel.rs index efa0b772..41b87e04 100644 --- a/src/mgmtchannel.rs +++ b/src/mgmtchannel.rs @@ -74,7 +74,14 @@ impl MgmtChannel { format!("got error response to: {:?}",&cmd) )?; }, - AlterGame { error: Some(error), .. } => { + AlterGame { error: Some(error), ref responses } => { + if let MgmtCommand::AlterGame { insns, .. } = &cmd { + if responses.len() < insns.len() { + Err(error.clone()) + .context("AlterGame insn failed") + .with_context(|| format!(" {:?}", &insns[responses.len()]))?; + } + } Err(error.clone()).context(format!( "game alterations failed (maybe partially); response to: {:?}", &cmd -- 2.30.2