| Just as bash scripts are executed with set -e (as to terminate on any error), so should PowerShell scripts be executed with $ErrorActionPreference = "Stop" at the top (to the same effect). Not only is it more consistent (e.g. with bash), it is also usually a more desirable behavior in CI scenarios (when you allow the script to continue you can miss important silent errors). A user can always start his script with $ErrorActionPreference = "Continue" to override this, or it could be a checkbox, or the user could simply wrap potentially erronous statements in a try-catch block (probably the best solution). |