-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Description
Advanced functions in PowerShell do not report errors the same way that cmdlets do unless you wrap the contents of each begin, process, and end block in a large try/catch{$PSCmdlet.ThrowTerminatingError($_)} block. This logic is helpful to users of advanced functions because it tells them what line in their code was being executed when PowerShell ran into an error, rather than what line inside of the advanced function (which, when written properly, should really be more of a black box) was being executed when PowerShell ran into an error. Both Compress-Archive and Expand-Archive should be updated to use this construct so that these advanced functions report errors just like compiled cmdlets do.