Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add a property to [System.Management.Automation.ErrorRecord] to distinguish error types (non-terminating, statement-terminating, script-terminating) #4781

Copy link
Copy link
@mklement0

Description

@mklement0
Issue body actions

As requested in #3158 and suggested by @SteveL-MSFT
in #3647 (comment).

Currently, you cannot derive from a [System.Management.Automation.ErrorRecord] instance whether it represents a non-terminating, a statement-terminating, or a script-terminating error.

Note that, on the command line, you can already detect a script-terminating error generated with a Throw statement by examining the relevant $Error collection entry's .Exception.WasThrownFromThrowStatement property, but that won't work for errors that were promoted to script-terminating ones via -ErrorAction Stop / $ErrorActionPreference = 'Stop' (such errors generate an accompanying [System.Management.Automation.ActionPreferenceStopException] error).

One useful application for allowing the discovery of a given error's "fatality" would be to enable error-type-specific coloring of error output, as discussed in the context of improving the standard error view in #3647.

Also see the expanded proposal below, which asks for two properties: the intrinsic severity, and the effective severity.

Environment data

PowerShell Core v6.0.0-beta.6
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.