-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add OutputType to Get-Error cmdlet and preserve original typenames
#10856
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
Conversation
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-Error.cs
Outdated
Show resolved
Hide resolved
|
@PoshChan please retry windows |
|
@SteveL-MSFT, successfully started retry of |
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 please retry static |
|
@SteveL-MSFT, successfully started retry of |
JamesWTruher
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.
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
|
@SteveL-MSFT Do you want to get approve from anybody? |
|
@JamesWTruher can you review? |
|
Up. |
JamesWTruher
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.
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
…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: |
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.