Skip to content

Commit

Permalink
Fix wrong error code returned in BindingManager::NotifyBoundClusterCh… (
Browse files Browse the repository at this point in the history
#24209)

* Fix wrong error code returned in BindingManager::NotifyBoundClusterChanged

* Review remarks addressed

* Error description changed
  • Loading branch information
milanr-q authored and pull[bot] committed Jul 28, 2023
1 parent e4fe714 commit 1313364
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/clusters/bindings/BindingManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ void BindingManager::FabricRemoved(FabricIndex fabricIndex)
CHIP_ERROR BindingManager::NotifyBoundClusterChanged(EndpointId endpoint, ClusterId cluster, void * context)
{
VerifyOrReturnError(mInitParams.mFabricTable != nullptr, CHIP_ERROR_INCORRECT_STATE);
VerifyOrReturnError(mBoundDeviceChangedHandler, CHIP_NO_ERROR);
VerifyOrReturnError(mBoundDeviceChangedHandler != nullptr, CHIP_ERROR_HANDLER_NOT_SET);

CHIP_ERROR error = CHIP_NO_ERROR;
auto * bindingContext = mPendingNotificationMap.NewPendingNotificationContext(context);
Expand Down
3 changes: 3 additions & 0 deletions src/lib/core/CHIPError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,9 @@ bool FormatCHIPError(char * buf, uint16_t bufSize, CHIP_ERROR err)
case CHIP_ERROR_MISSING_URI_SEPARATOR.AsInteger():
desc = "The URI separator is missing";
break;
case CHIP_ERROR_HANDLER_NOT_SET.AsInteger():
desc = "Callback function or callable object is not set";
break;
}
#endif // !CHIP_CONFIG_SHORT_ERROR_STR

Expand Down
8 changes: 8 additions & 0 deletions src/lib/core/CHIPError.h
Original file line number Diff line number Diff line change
Expand Up @@ -2427,6 +2427,14 @@ using CHIP_ERROR = ::chip::ChipError;
*/
#define CHIP_ERROR_MISSING_URI_SEPARATOR CHIP_CORE_ERROR(0xe0)

/**
* @def CHIP_ERROR_HANDLER_NOT_SET
*
* @brief
* Callback function or callable object is not set
*/
#define CHIP_ERROR_HANDLER_NOT_SET CHIP_CORE_ERROR(0xe1)

// clang-format on

// !!!!! IMPORTANT !!!!! If you add new CHIP errors, please update the translation
Expand Down
1 change: 1 addition & 0 deletions src/lib/core/tests/TestCHIPErrorStr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ static const CHIP_ERROR kTestElements[] =
CHIP_ERROR_BUSY,
CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_REPORT_IB,
CHIP_ERROR_IM_MALFORMED_EVENT_STATUS_IB,
CHIP_ERROR_HANDLER_NOT_SET,
};
// clang-format on

Expand Down

0 comments on commit 1313364

Please sign in to comment.