Skip to content

Add OutputType to Get-Error cmdlet and preserve original typenames - #10856

Merged
Ilya (iSazonov) merged 7 commits into
PowerShell:masterfrom
SteveL-MSFT:geterror-outputtype
Nov 19, 2019
Merged

Ilya (iSazonov) merged 7 commits into
PowerShell:masterfrom
SteveL-MSFT:geterror-outputtype

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Oct 21, 2019 •

Copy link
Copy Markdown
Member

PR Summary

Cmdlet was missing declaring OutputType which is ErrorRecord#PSExtendedError and Exception#PSExtendedError. 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.

PR Checklist

@SteveL-MSFT

Copy link
Copy Markdown
Member Author

PoshChan-Bot (@PoshChan) please retry windows

@PoshChan

Copy link
Copy Markdown
Collaborator

Steve Lee (@SteveL-MSFT), successfully started retry of PowerShell-CI-Windows

get-error outputtype is errorrecord and exception
fix formatting that wasn't handling parse exceptions correctly
update tests to check typenames
@SteveL-MSFT Steve Lee (SteveL-MSFT) changed the title Add OutputType to Get-Error cmdlet Add OutputType to Get-Error cmdlet and preserve original typenames Oct 22, 2019
@SteveL-MSFT

Copy link
Copy Markdown
Member Author

PoshChan-Bot (@PoshChan) please retry static

@PoshChan

Copy link
Copy Markdown
Collaborator

Steve Lee (@SteveL-MSFT), successfully started retry of PowerShell-CI-static-analysis

Copy link
Copy Markdown
Collaborator

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

@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Oct 22, 2019
@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Oct 23, 2019
@iSazonov Ilya (iSazonov) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Oct 30, 2019
@iSazonov Ilya (iSazonov) added this to the 7.0.0-preview.6 milestone Oct 30, 2019
@iSazonov

Copy link
Copy Markdown
Collaborator

Steve Lee (@SteveL-MSFT) Do you want to get approve from anybody?

@SteveL-MSFT

Copy link
Copy Markdown
Member Author

James Truher (@JamesWTruher) can you review?

@iSazonov

Copy link
Copy Markdown
Collaborator

Up.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

just a couple questions

@iSazonov
Ilya (iSazonov) merged commit 9b71696 into PowerShell:master Nov 19, 2019
Travis Plunk (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.
@ghost

Copy link
Copy Markdown

🎉v7.0.0-rc.1 has been released which incorporates this pull request.:tada:

Handy links:

@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the geterror-outputtype branch June 6, 2020 02:30
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
…owerShell#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants