Skip to content

Added more helpful message for AmbiguousParameterSet exception - #5435

Closed
PRASOON KARUNAN V (kvprasoon) wants to merge 9 commits into
PowerShell:masterfrom
kvprasoon:kvprasoon-patch-1-AmbiguousParameterSet
Closed

PRASOON KARUNAN V (kvprasoon) wants to merge 9 commits into
PowerShell:masterfrom
kvprasoon:kvprasoon-patch-1-AmbiguousParameterSet

Conversation

@kvprasoon

Copy link
Copy Markdown
Contributor

Added more helpful message for AmbiguousParameterSet exception which always throws exception "Parameter set cannot be resolved using the specified named parameters" which is not properly conveying the end user for further steps required.

…ion the depth of the split operation."

This reverts commit 8215869.
Added more helpful message for AmbiguousParameterSet exception which always throws exception "Parameter set cannot be resolved using the specified named parameters" which is not properly conveying the end user for further steps required.

@markekraus Mark Kraus (markekraus) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing! Please make modifications to your pull request.

</data>
<data name="AmbiguousParameterSet" xml:space="preserve">
<value>Parameter set cannot be resolved using the specified named parameters.</value>
<value>Parameter set cannot be resolved using the specified named parameters.One or few of the parameters mentioned cannot be used together.Do a Get-command {0} to see the available parameter sets.</value>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Add spaces between periods and the first word of a sentence
  • One or few should be One or more but, this could also occur when an insufficient number of parameters have been supplied, not just when 2 parameters cannot be used together.
  • parameters mentioned should be parameters issued.
  • Do a Get-command {0} do all instances of this error pass the current command name to this string for formatting? if not, this could be very confusing.
  • Get-Help would be preferable to Get-Command as Get-Command does not show this information be default.
  • parameter sets is some what esoteric to function./cmdlet authors. To an admin user it might be better to say For syntax help.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi , Thanks for the review, I'll do the required modifications


Previoues review comments
• Add spaces between periods and the first word of a sentence - Done
• One or few  should be  One or more  but, this could also occur when an insufficient number of parameters have been supplied, not just when 2 parameters cannot be used together. - Done
• parameters mentioned  should be  parameters issued . - Done
• Do a Get-command {0}  do all instances of this error pass the current command name to this string for formatting? if not, this could be very confusing. - Done, changed to a generic message without deending on the first element
• Get-Help  would be preferable to  Get-Command  as  Get-Command  does not show this information be default. - Done, changed to Get-Help
• parameter sets  is some what esoteric to function./cmdlet authors. To an admin user it might be better to say  For syntax help . - Done
@kvprasoon

Copy link
Copy Markdown
Contributor Author

I have updated it as per the comments

Added cmdlets along with script/function in the error message .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review,I have updated it as per the comments

• Add spaces between periods and the first word of a sentence - Done
• One or few should be One or more but, this could also occur when an insufficient number of parameters have been supplied, not just when 2 parameters cannot be used together. - Done
• parameters mentioned should be parameters issued . - Done
• Do a Get-command {0} do all instances of this error pass the current command name to this string for formatting? if not, this could be very confusing. - Done, changed to a generic message without deending on the first element
• Get-Help would be preferable to Get-Command as Get-Command does not show this information be default. - Done, changed to Get-Help
• parameter sets is some what esoteric to function./cmdlet authors. To an admin user it might be better to say For syntax help . - Done

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review,I have updated it as per the comments

• Add spaces between periods and the first word of a sentence - Done
• One or few should be One or more but, this could also occur when an insufficient number of parameters have been supplied, not just when 2 parameters cannot be used together. - Done
• parameters mentioned should be parameters issued . - Done
• Do a Get-command {0} do all instances of this error pass the current command name to this string for formatting? if not, this could be very confusing. - Done, changed to a generic message without deending on the first element
• Get-Help would be preferable to Get-Command as Get-Command does not show this information be default. - Done, changed to Get-Help
• parameter sets is some what esoteric to function./cmdlet authors. To an admin user it might be better to say For syntax help . - Done

</data>
<data name="AmbiguousParameterSet" xml:space="preserve">
<value>Parameter set cannot be resolved using the specified named parameters.</value>
<value>Parameter set cannot be resolved using the specified named parameters. One or more of the parameters issued cannot be used together. Do a Get-Help on your script/function/cmdlet for the syntax help.</value>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • One or more of the parameters issued cannot be used together. This still doesn't address the case where too few parameters are supplied. For example: foo has 2 parameter sets -A -B -C and -A -B -D but the user only supplied -A -B. It's not that -A and -B can't be used together, but that -C or -D are needed to determine the parameter set.
  • Do a Get-Help on your script/function/cmdlet for the syntax help. I think this is would be somewhat confusing. I'm not sure how to fix it. The wording could at least be improved Use Get-Help with your script, function, or cmdlet for syntax help.

One or more of the parameters issued cannot be used together.  This still doesn't address the case where too few parameters are supplied. For example:  foo  has 2 parameter sets  -A -B -C  and  -A -B -D  but the user only supplied  -A -B . It's not that  -A  and  -B  can't be used together, but that  -C  or  -D  are needed to determine the parameter set. - Added the information about not using the decision making parameter
• Do a Get-Help on your script/function/cmdlet for the syntax help.  I think this is would be somewhat confusing. I'm not sure how to fix it. The wording could at least be improved  Use Get-Help with your script, function, or cmdlet for syntax help.  - changed to suggested message

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One or more of the parameters issued cannot be used together. This still doesn't address the case where too few parameters are supplied. For example: foo has 2 parameter sets -A -B -C and -A -B -D but the user only supplied -A -B . It's not that -A and -B can't be used together, but that -C or -D are needed to determine the parameter set. - Added the information about not using the decision making parameter
• Do a Get-Help on your script/function/cmdlet for the syntax help. I think this is would be somewhat confusing. I'm not sure how to fix it. The wording could at least be improved Use Get-Help with your script, function, or cmdlet for syntax help. - changed to suggested message

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can anyone help me by reviewing this

@iSazonov

Copy link
Copy Markdown
Collaborator

PRASOON KARUNAN V (@kvprasoon) I guess PowerShell team is fully obsessed with the release of the new version.
Also please rebase to get latest updates - I think this help to pass CIs.

/cc Steve Lee (@SteveL-MSFT) Should we use direct tips in error messages or use HelpSystem capabilites?

</data>
<data name="AmbiguousParameterSet" xml:space="preserve">
<value>Parameter set cannot be resolved using the specified named parameters.</value>
<value>Parameter set cannot be resolved using the specified named parameters. One or more parameters issued cannot be used together or a parameter which will decide the parameter set is not provided. Use Get-Help with your script, function, or cmdlet for syntax help.</value>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or a parameter which will decide the parameter set is not provided.

Perhaps this should be or an insufficient number of parameters were provided. There could certainly be more than one missing.

@SteveL-MSFT

Copy link
Copy Markdown
Member

Ilya (@iSazonov) since you added Type 'help' for help as part of the startup banner, it seems unnecessary to point users to get-help in any error message. PowerShell does have a suggestion system that we should try to take advantage of in the future to provide more concise help on how to resolve issues (like if they type a parameter name wrong, we can do some matching and suggest what they meant which is different from this PR).

For this particular issue, I think the ideal error message would tell the user which parameters are mutually exclusive and can't be used together or if another parameter is required to resolve the parameter set. I added a note to #5175 which covers a new proposal on defining mutually exclusive parameters to have better error messages.

For this PR, I think it would be sufficient to update the error message to what Mark Kraus (@markekraus) is proposing without the get-help mention on the end which is to generic.

@iSazonov

Copy link
Copy Markdown
Collaborator

Steve Lee (@SteveL-MSFT) Thanks for clarify and confirm my thoughts.

@markekraus

Mark Kraus (markekraus) commented Nov 20, 2017 •

Copy link
Copy Markdown
Contributor

#5505 has been opened instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants