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

Better logging when Darwin.framework is asked to encode an incorrect type in a list. #36599

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import "MTRClusterStateCacheContainer_Internal.h"
#import "MTRCommandPayloadsObjc.h"
#import "MTRDevice_Internal.h"
#import "MTRLogging_Internal.h"
#import "MTRStructsObjc.h"
#import "NSStringSpanConversion.h"
#import "NSDataSpanConversion.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#import "MTRCommandPayloads_Internal.h"
#import "MTRCommandPayloadExtensions_Internal.h"
#import "MTRBaseDevice_Internal.h"
#import "MTRDefines_Internal.h"
#import "MTRError_Internal.h"
#import "MTRLogging_Internal.h"
#import "NSStringSpanConversion.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
}
listFreer.add(listHolder_{{depth}});
for (size_t i_{{depth}} = 0; i_{{depth}} < {{source}}.count; ++i_{{depth}}) {
if ( ! [{{source}}[i_{{depth}}] isKindOfClass: [{{asObjectiveCClass type cluster forceNotList=true}} class]] ) {
auto element_{{depth}} = MTR_SAFE_CAST({{source}}[i_{{depth}}], {{asObjectiveCClass type cluster forceNotList=true}});
if (!element_{{depth}}) {
// Wrong kind of value.
MTR_LOG_ERROR("%@ incorrectly present in list of %@", {{source}}[i_{{depth}}], NSStringFromClass({{asObjectiveCClass type cluster forceNotList=true}}.class));
{{errorCode}}
}
auto element_{{depth}} = ({{asObjectiveCClass type cluster forceNotList=true}} *){{source}}[i_{{depth}}];
{{>encode_value target=(concat "listHolder_" depth "->mList[i_" depth "]") source=(concat "element_" depth) cluster=cluster errorCode=errorCode depth=(incrementDepth depth) isArray=false}}
}
{{target}} = ListType_{{depth}}(listHolder_{{depth}}->mList, {{source}}.count);
Expand Down
Loading
Loading