Skip to content

Fix error reporting in Compress-Archive and Expand-Archive #13

@KirkMunro

Description

@KirkMunro

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions