Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CASESession] refactoring and improving testability of Sigma1 sending and handling, and Sigma2 Sending #36679

Merged
merged 19 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/lib/support/CodeUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,33 @@
} \
} while (false)

/**
* @def ReturnErrorVariantOnFailure(expr)
*
* @brief
* This is for use when the calling function returns a Variant type. It returns a CHIP_ERROR variant with the corresponding error
* code if the expression returns an error.
*
* Example usage:
*
* @code
* ReturnErrorVariantOnFailure(NextStep, ParseSigma1(tlvReader, parsedSigma1));
* @endcode
*
* @param[in] variantType The Variant type that the calling function returns.
* @param[in] expr An expression to be tested.

*/
#define ReturnErrorVariantOnFailure(variantType, expr) \
do \
{ \
auto __err = (expr); \
if (!::chip::ChipError::IsSuccess(__err)) \
{ \
return variantType::Create<CHIP_ERROR>(__err); \
} \
} while (false)

/**
* @def ReturnLogErrorOnFailure(expr)
*
Expand Down
Loading
Loading