Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Useful error message when HelpMessage attributes are empty string#4334

Merged
daxian-dbw merged 1 commit into
PowerShell:masterPowerShell/PowerShell:masterfrom
SteveL-MSFT:helpmessageSteveL-MSFT/PowerShell:helpmessageCopy head branch name to clipboard
Jul 26, 2017
Merged

Useful error message when HelpMessage attributes are empty string#4334
daxian-dbw merged 1 commit into
PowerShell:masterPowerShell/PowerShell:masterfrom
SteveL-MSFT:helpmessageSteveL-MSFT/PowerShell:helpmessageCopy head branch name to clipboard

Conversation

@SteveL-MSFT

Copy link
Copy Markdown
Member

Fix invalid value error message on some cmdlet attributes to point to the specific attribute.

Removed wrapping of argument exception into not useful requires exception

Before:

.\helpmessage.ps1 : Cannot process the #requires statement because it is not in the correct format.
The #requires statement must be in one of the following formats:
 "#requires -shellid <shellID>"
 "#requires -version <major.minor>"
 "#requires -psedition <edition>"
 "#requires -pssnapin <psSnapInName> [-version <major.minor>]"
 "#requires -modules <ModuleSpecification>"
 "#requires -runasadministrator"
At line:1 char:1
+ .\helpmessage.ps1
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (helpmessage.ps1:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : ScriptRequiresInvalidFormat

After:

Cannot process argument because the value of argument "HelpMessage" is not valid. Change the value of the
"HelpMessage" argument and run the operation again.
At line:1 char:1
+ .\helpmessage.ps1
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : Argument

Fix #4331

… the specific attribute.

Removed wrapping of argument exception into not useful requires exception

@lzybkr lzybkr 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.

I sign off assuming the #requires error message has not degraded from this change.

@SteveL-MSFT

Copy link
Copy Markdown
Member Author

@lzybkr ScriptRequiresException still gets thrown in all other cases

@daxian-dbw daxian-dbw merged commit 0cd7a4a into PowerShell:master Jul 26, 2017
@SteveL-MSFT SteveL-MSFT deleted the helpmessage branch July 26, 2017 16:28
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.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.