[chip-tool] When sending a command fails for some reasons, chip-tool ignore the error (#13690)
diff --git a/examples/chip-tool/commands/clusters/ModelCommand.cpp b/examples/chip-tool/commands/clusters/ModelCommand.cpp
index a8e5ddd..bf1af71 100644
--- a/examples/chip-tool/commands/clusters/ModelCommand.cpp
+++ b/examples/chip-tool/commands/clusters/ModelCommand.cpp
@@ -33,7 +33,9 @@
{
ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnDeviceConnectedFn: context is null"));
- command->SendCommand(device, command->mEndPointId);
+
+ CHIP_ERROR err = command->SendCommand(device, command->mEndPointId);
+ VerifyOrReturn(CHIP_NO_ERROR == err, command->SetCommandExitStatus(err));
}
void ModelCommand::OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR err)