-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
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 more
Description
Background
Error handling in PowerShell is extremely messy, by far the primary complaint I have heard about the language, and has actually been cited as a reason to not use PowerShell. The two major complaints I've heard about error handling are:
- The two parallel universes of errors
- Poor handling of errors from binaries (described in this feature request)
Current behavior
When running a binary command in PowerShell (ex: git) and the binary errors, the command does not always output an error (neither terminating nor non-terminating). PowerShell clearly detects that the command fails and correctly populates $?, but does not integrate with normal error handling mechanisms. The result is this cumbersome syntax:
git checkout -b master
if (-not $?) {
throw "Command failed"
}Summary of the new feature/enhancement
If a command sets $? to $false, then the command should write an error to the error stream.
zachChilders and tylorhlreynoldsbd
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 more