Skip to content

Add a CR to CommandNotFoundException error string - #4934

Merged
Dongbo Wang (daxian-dbw) merged 1 commit into
masterfrom
jpsnover-patch-1
Sep 29, 2017
Merged

Dongbo Wang (daxian-dbw) merged 1 commit into
masterfrom
jpsnover-patch-1

Conversation

@jpsnover

Copy link
Copy Markdown
Contributor

We're here at PowerShell Unplugged at Ignite, and this error message could really use a carriage return!

We're here at PowerShell Unplugged at Ignite, and this error message could *really* use a carriage return!

@SteveL-MSFT Steve Lee (SteveL-MSFT) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the contribution, but string resources should not contain newlines as it may produce unexpected results when it goes through FormatAndOutput

</data>
<data name="CommandNotFoundException" xml:space="preserve">
<value>The term '{0}' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.</value>
<value>The term '{0}' is not recognized as the name of a cmdlet, function, script file, or operable program.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Formatting should be handled by FormatAndOutput. String messages should not contain newlines.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps adding new newlines is something we should consider for other strings as it can improve readability.

@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit b9845d5 into master Sep 29, 2017
@daxian-dbw
Dongbo Wang (daxian-dbw) deleted the jpsnover-patch-1 branch September 29, 2017 19:16
@iSazonov

Ilya (iSazonov) commented Oct 2, 2017 •

Copy link
Copy Markdown
Collaborator

Please clarify what was idea here.
Before the change:

> qwerty
qwerty : The term 'qwerty' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:1
+ qwerty
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (qwerty:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

After the change:

PS C:\Users\sie\Documents\GitHub\iSazonov\PowerShell> qwerty
qwerty : The term 'qwerty' is not recognized as the name of a cmdlet, function, script file, or operable program.
      Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ qwerty
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (qwerty:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Or idea was to change command line error formatting?
From:

> .\debug\powershell.exe -sma
The argument '-sma' is not recognized as the name of a script file. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

To:

> .\debug\powershell.exe -sma
The argument '-sma' is not recognized as the name of a script file. 
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

@iSazonov

Copy link
Copy Markdown
Collaborator

Steve Lee (@SteveL-MSFT) Could you please clarify?

@SteveL-MSFT

Copy link
Copy Markdown
Member

Ilya (@iSazonov) I believe the intent was to have the next sentence on the next line left justified. The whitespace should have been removed. I'll submit PR.

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
…#4934)

We're here at PowerShell Unplugged at Ignite, and this error message could *really* use a new line!
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