-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Implement Get-Error
cmdlet as Experimental Feature
#10727
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
Implement Get-Error
cmdlet as Experimental Feature
#10727
Conversation
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Resolve-ErrorRecord.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Resolve-ErrorRecord.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Resolve-ErrorRecord.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Resolve-ErrorRecord.cs
Outdated
Show resolved
Hide resolved
@PoshChan please retry static |
@SteveL-MSFT, successfully started retry of |
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Resolve-ErrorRecord.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Resolve-ErrorRecord.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Resolve-ErrorRecord.cs
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/Resolve-ErrorRecord.Tests.ps1
Outdated
Show resolved
Hide resolved
a02ae5b
to
4d38f68
Compare
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Resolve-ErrorRecord.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Resolve-ErrorRecord.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Resolve-ErrorRecord.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Resolve-ErrorRecord.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Resolve-ErrorRecord.cs
Outdated
Show resolved
Hide resolved
Resolve-ErrorRecord
cmdlet as Experimental FeatureGet-Error
cmdlet as Experimental Feature
Love the new name, the use of color and the completely left-justified stack traces. Nice! Unfortunately, don't love so much the indentation approach to nested exceptions. It is a bit visually hard to follow and I don't think it scales past about 2 (maybe 3) nested exceptions. We've provided a command like this in the past in PSCX that shows nested exceptions in subsequent sections which I think is easier to follow visually and scales to any number of nested exceptions:
Now, pair this approach with some coloring to highlight field names and nested exception separators and I think it would work very nicely. |
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.
nothing blocking, just a few questions
src/Modules/Unix/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1
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
Outdated
Show resolved
Hide resolved
...stem.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs
Outdated
Show resolved
Hide resolved
@rkeithhill I get your feedback. At this time, I'd like to get this out to users and get additional feedback. We can still provide alternate views. |
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-Error.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-Error.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-Error.cs
Outdated
Show resolved
Hide resolved
…it is filled with errors
…ndling of Dictionary/Hashtable type
…shown as it's not useful
a2ee936
to
36c87e6
Compare
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 one non-blocking question.
...stem.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs
Show resolved
Hide resolved
So nice that it shows the the way of error and liked the way that null members are not shown,before while tracing errors in the console it is bit pain sometimes by calling members one by one to know the values and the members which haven't .but this shows up all the members only having values thats easy to trace. Indentation for the nested object is cool ,so that easy to find member to reside on which property.as @rkeithhill suggested about the output for nested object,i personally feel that would be bit confusing while tracking down |
@manoj2994 please add your feedback to the RFC PowerShell/PowerShell-RFC#228. I think other visualizations will have their own pros and cons. If an ErrorRecord has multiple nested Exceptions, showing them independently will lose the contextual information that indention provides. |
This is the textbook example for the defined verb "RESOLVE" |
@jpsnover the key problem is that AzPS already has a |
PR Summary
Based on @PowerShell/powershell-committee discussion, we decided to change the cmdlet to
Get-Error
. RFC to be updated.Implement
Get-Error
cmdlet to render errors/exceptions from $error or pipeline. Rendering is recursive for nested objects for Exceptions, InvocationInfo, and Arrays otherwise it uses ToString(). Members that are empty or null are not shown. Indentation is always 4 spaces for nested objects. There is a whitelist of types for nested objects otherwise the output is unusable since most types in .NET are objects and many members are useful for programming but not for visual viewing.A new
FormatAccentColor
is introduced to highlight property names from their values. This can be used later to add accents to tables and list formatting. Removed some commented out unneeded code from ConciseView. StackTraces given how long the strings are always left justified instead of indented (the whitespace at the beginning is part of the string, not trimming it).PR Context
Implement
Get-Error
from PowerShell/PowerShell-RFC#228PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.Get-Error
MicrosoftDocs/PowerShell-Docs#4904