-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Added more helpful message for AmbiguousParameterSet exception #5435
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
Added more helpful message for AmbiguousParameterSet exception #5435
Conversation
…depth of the split operation.
This reverts commit 128a454.
…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
left a comment
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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 fewshould beOne or morebut, this could also occur when an insufficient number of parameters have been supplied, not just when 2 parameters cannot be used together.parameters mentionedshould beparameters 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-Helpwould be preferable toGet-CommandasGet-Commanddoes not show this information be default.parameter setsis some what esoteric to function./cmdlet authors. To an admin user it might be better to sayFor syntax help.
There was a problem hiding this comment.
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
|
I have updated it as per the comments |
Added cmdlets along with script/function in the error message .
kvprasoon
left a comment
There was a problem hiding this comment.
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
kvprasoon
left a comment
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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:foohas 2 parameter sets-A -B -Cand-A -B -Dbut the user only supplied-A -B. It's not that-Aand-Bcan't be used together, but that-Cor-Dare 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 improvedUse 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
kvprasoon
left a comment
There was a problem hiding this comment.
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
kvprasoon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please review
kvprasoon
left a comment
There was a problem hiding this comment.
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
|
@kvprasoon I guess PowerShell team is fully obsessed with the release of the new version. /cc @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> |
There was a problem hiding this comment.
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.
|
@iSazonov since you added 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 @markekraus is proposing without the |
|
@SteveL-MSFT Thanks for clarify and confirm my thoughts. |
|
#5505 has been opened instead. |
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.