Add OutputType to Get-Error cmdlet and preserve original typenames#10856
Merged
iSazonov merged 7 commits intoPowerShell:masterfrom Nov 19, 2019
Merged
Add OutputType to Get-Error cmdlet and preserve original typenames#10856iSazonov merged 7 commits intoPowerShell:masterfrom
Get-Error cmdlet and preserve original typenames#10856iSazonov merged 7 commits intoPowerShell:masterfrom
Conversation
14 tasks
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-Error.cs
Outdated
Show resolved
Hide resolved
PoshChan
reviewed
Oct 22, 2019
Member
Author
|
@PoshChan please retry windows |
Collaborator
|
@SteveL-MSFT, successfully started retry of |
iSazonov
reviewed
Oct 22, 2019
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-Error.cs
Outdated
Show resolved
Hide resolved
get-error outputtype is errorrecord and exception fix formatting that wasn't handling parse exceptions correctly update tests to check typenames
Get-Error cmdletGet-Error cmdlet and preserve original typenames
PoshChan
reviewed
Oct 22, 2019
Member
Author
|
@PoshChan please retry static |
Collaborator
|
@SteveL-MSFT, successfully started retry of |
PoshChan
reviewed
Oct 22, 2019
JamesWTruher
suggested changes
Oct 22, 2019
Collaborator
JamesWTruher
left a comment
There was a problem hiding this comment.
I think you have a typo in there
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-Error.cs
Outdated
Show resolved
Hide resolved
...stem.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs
Show resolved
Hide resolved
...stem.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs
Show resolved
Hide resolved
...stem.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs
Show resolved
Hide resolved
...stem.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/Get-Error.Tests.ps1
Outdated
Show resolved
Hide resolved
iSazonov
reviewed
Oct 23, 2019
iSazonov
approved these changes
Oct 30, 2019
Collaborator
|
@SteveL-MSFT Do you want to get approve from anybody? |
Member
Author
|
@JamesWTruher can you review? |
Collaborator
|
Up. |
Collaborator
JamesWTruher
left a comment
There was a problem hiding this comment.
just a couple questions
...stem.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/Get-Error.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/Get-Error.Tests.ps1
Outdated
Show resolved
Hide resolved
JamesWTruher
approved these changes
Nov 18, 2019
TravisEz13
pushed a commit
that referenced
this pull request
Dec 4, 2019
…10856) - Added OutputType attribute. - Cmdlet adds the PSExtendedError typename and removes Exception and ErrorRecord typenames so that the formatting is used. The formatter then removes PSExtendedError and puts back the original typename so that $Error should be the same before calling Get-Error. - While testing, had to make some changes to how InvocationInfo is retrieved so that ParseException which contains a nested ErrorRecord which as InvocationInfo is handled correctly. - Combined Exception and ErrorRecord formatter into one.
|
🎉 Handy links: |
22 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Cmdlet was missing declaring OutputType which is
ErrorRecord#PSExtendedErrorandException#PSExtendedError. Added OutputType attribute. Cmdlet adds thePSExtendedErrortypename and removesExceptionandErrorRecordtypenames so that the formatting is used. The formatter then removesPSExtendedErrorand puts back the original typename so that$Errorshould be the same before callingGet-Error. While testing, had to make some changes to how InvocationInfo is retrieved so that ParseException which contains a nested ErrorRecord which as InvocationInfo is handled correctly. Combined Exception and ErrorRecord formatter into one.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.