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

Need better error output when chip-tool struct members are not quoted. #14906

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
4 changes: 2 additions & 2 deletions examples/chip-tool/commands/clusters/ComplexArgument.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,14 @@ class ComplexArgumentParser
return CHIP_NO_ERROR;
}

static CHIP_ERROR EnsureMemberExist(const char * label, bool hasMember)
static CHIP_ERROR EnsureMemberExist(const char * label, const char * memberName, bool hasMember)
{
if (hasMember)
{
return CHIP_NO_ERROR;
}

ChipLogError(chipTool, "%s is required.", label);
ChipLogError(chipTool, "%s is required. Should be provided as {\"%s\": value}", label, memberName);
return CHIP_ERROR_INVALID_ARGUMENT;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, {{zapTypeToEncodable

{{#zcl_struct_items}}
{{#unless isOptional}}
ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("{{parent.name}}.{{asLowerCamelCase label}}", value.isMember("{{asLowerCamelCase label}}")));
ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("{{parent.name}}.{{asLowerCamelCase label}}", "{{asLowerCamelCase label}}", value.isMember("{{asLowerCamelCase label}}")));
{{/unless}}
{{/zcl_struct_items}}

Expand Down
Loading