Skip to content

Conversation

@SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Nov 14, 2019

PR Summary

For Get-Error cmdlet, if the object (or nested object) is an Exception, we add an ExceptionType property that has the full type name. The Exception type is useful information and this change doesn't require the user to explore the error object to get it.

Example:

PS> 1/0
RuntimeException: Attempted to divide by zero.
PS> gerr

Exception             :
    ExceptionType  : System.Management.Automation.RuntimeException
    ErrorRecord    :
        Exception             :
            ExceptionType : System.Management.Automation.ParentContainsErrorRecordException
            Message       : Attempted to divide by zero.
            HResult       : -2146233087
        CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
        FullyQualifiedErrorId : RuntimeException
        InvocationInfo        :
            ScriptLineNumber : 1
            OffsetInLine     : 1
            HistoryId        : -1
            Line             : 1/0
            PositionMessage  : At line:1 char:1
                               + 1/0
                               + ~~~
            CommandOrigin    : Internal
        ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
    TargetSite     :
        Name          : Divide
        DeclaringType : System.Management.Automation.IntOps
        MemberType    : Method
        Module        : System.Management.Automation.dll
    StackTrace     :
   at System.Management.Automation.IntOps.Divide(Int32 lhs, Int32 rhs) in /Users/steve/repos/PowerShell/src/System.Management.Automation/engine/runtime/Operations/NumericOps.cs:line 61
   at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
   at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame) in /Users/steve/repos/PowerShell/src/System.Management.Automation/engine/interpreter/DynamicInstructions.Generated.cs:line 166
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) in /Users/steve/repos/PowerShell/src/System.Management.Automation/engine/interpreter/ControlFlowInstructions.cs:line 357
    Message        : Attempted to divide by zero.
    Data           : System.Collections.ListDictionaryInternal
    InnerException :
        ExceptionType : System.DivideByZeroException
        Message       : Attempted to divide by zero.
        HResult       : -2147352558
    Source         : System.Management.Automation
    HResult        : -2146233087
CategoryInfo          : NotSpecified: (:) [], RuntimeException
FullyQualifiedErrorId : RuntimeException
InvocationInfo        :
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : -1
    Line             : 1/0
    PositionMessage  : At line:1 char:1
                       + 1/0
                       + ~~~
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1

PR Checklist

@TravisEz13
Copy link
Member

@PoshChan Please remind me in 1 hour

@PoshChan
Copy link
Collaborator

@TravisEz13, this is the reminder you requested 1 hour ago

@TravisEz13
Copy link
Member

@PoshChan Please remind me in 1 hour

@PoshChan
Copy link
Collaborator

@TravisEz13, this is the reminder you requested 1 hour ago

@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Nov 16, 2019
@iSazonov iSazonov added this to the 7.0.0-preview.6 milestone Nov 16, 2019
@SteveL-MSFT
Copy link
Member Author

changed property name from ExceptionType to just Type based on @mklement0's feedback

@SteveL-MSFT SteveL-MSFT changed the title Add ExceptionType member to Exceptions for Get-Error Add Type member to Exceptions containing type of exception for Get-Error Nov 19, 2019
@SteveL-MSFT
Copy link
Member Author

@PoshChan please retry windows

@SteveL-MSFT
Copy link
Member Author

CodeFactor issue is by-design

@PoshChan
Copy link
Collaborator

@SteveL-MSFT, successfully started retry of PowerShell-CI-Windows

@SteveL-MSFT SteveL-MSFT deleted the get-error-exception-type branch December 4, 2019 22:42
@TravisEz13 TravisEz13 modified the milestones: rc.1-approved, 7.0.0-rc.1 Dec 4, 2019
@TravisEz13 TravisEz13 modified the milestones: 7.0.0-rc.1, GA-approved Dec 20, 2019
@daxian-dbw daxian-dbw modified the milestones: GA-approved, 7.0.0-rc.2 Jan 11, 2020
@ghost
Copy link

ghost commented Jan 16, 2020

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

Handy links:

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