From 0ba84d4f983b00b21ad32d5abab177fca5739fc7 Mon Sep 17 00:00:00 2001 From: Song Guo Date: Fri, 21 May 2021 11:35:50 +0800 Subject: [PATCH] Fix error code when cluster not exists --- src/app/CommandHandler.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/CommandHandler.cpp b/src/app/CommandHandler.cpp index 2a561f0fa3038b..9ef1ccd9aabee7 100644 --- a/src/app/CommandHandler.cpp +++ b/src/app/CommandHandler.cpp @@ -116,8 +116,9 @@ CHIP_ERROR CommandHandler::ProcessCommandDataElement(CommandDataElement::Parser // The Path is not present when there is an error to be conveyed back. ResponseCommandElement would only have status code, // set the error with CHIP_NO_ERROR, then continue to process rest of commands - AddStatusCode(&returnStatusParam, GeneralStatusCode::kInvalidArgument, Protocols::SecureChannel::Id, - Protocols::SecureChannel::kProtocolCodeGeneralFailure); + AddStatusCode(&returnStatusParam, + err == CHIP_ERROR_INVALID_PROFILE_ID ? GeneralStatusCode::kNotFound : GeneralStatusCode::kInvalidArgument, + Protocols::SecureChannel::Id, Protocols::SecureChannel::kProtocolCodeGeneralFailure); err = CHIP_NO_ERROR; } return err;